how can i make a windows without <windows.h>

im so confused about this header file.
and i dont know how this is created.
and i wonder if i can creat a windows use standard c++ library.
this question maybe not a good question.
i know little about computer.
and i so confused about how this process.
Last edited on
i dont know how this is created
It's created my the Microsoft team who maintain Windows.

i wonder if i can creat a windows use standard c++ library
Yes you can, but only console applications. It can't use any Windows specific things, like the graphical interface, or run as a background service.

i so confused about how this process.
Platform developers provide libraries that allow programs to access their system. Microsoft's basic libraries are called The Platform Software Development Kit. It is a set of header files (of definitions) and libraries that allow applications to interact with Windows.

The same is true of Linux or RiscOS or any platform.
Last edited on
console applications is just like black and useless things
why compiler can read that?
how to implementation it in c++?
why i cant do the same things.
console programs are far from useless. I write one or two a week. Many of them take me less than 1/2 an hour to write and debug; my most recent one repaired 1.4 million flawed xml messages. I didn't need to spend an hour adding a window with a button and remapping the output to a text box, I just shot it to the output and redirected into a file.

you can do the same things. But you are asking how to build a space shuttle in your basement using materials bought at the local hardware store. Its possible, if you had infinite knowledge, time, and energy to put into it, but in practice, one person starting from scratch to do that has a long, long road ahead.

To get started, you need to write your own graphics library. You will want to figure out how to talk to the driver for the video card and tell it where to put what pixels. Unless you also want to write the driver yourself too? To talk to the driver without using a library, you will need to know a lot about pointers, interrupts, and how your system works.

you can do pretty much anything with pointers on your system, commanding the OS etc or calling things are all really just parameters dumped on the stack or registers and a pointer to call a routine. Its just ugly to code that way; its basically abusing the lower level C capabilities of c++ to pretend to be assembly language.

I guess what you don't understand, maybe, is that windows.h is a starting point into dozens of library files that contain thousands of routines build off millions of lines of code. It was written by many people over decades.
Last edited on
ok thank you
I'm going to argue the opposite, don't waste your life trying to re-invent the wheel with a new graphics/windowing/GUI library. Especially not before you try other people's libraries to see what they actually can do.

As kbw talked about, the C++ standard library by itself does not have a notion of windows, only standard out/in. To use windows, you must use the API that your operating system gives you.

Depending on what you want to use a window for, many libraries already exist that are much nicer to use than the raw Win32 API. SFML is an easy-to-use library for creating graphical applications and games, but isn't really a widget library. If you want widget libraries, look into things such as https://en.wikipedia.org/wiki/List_of_widget_toolkits

I also recommend creating simple menus, buttons, and forms with WinForms or WPF (Windows Presentation Foundation), but this is C#.

_______________________________________________

Edit: If you're new to C++, I highly recommend just sticking with console input/output until you are comfortable with how to use C++, and then move onto GUI applications. Otherwise, be prepared for possible overwhelming confusion.
Last edited on
Easier options for GUI are Java and Python.
C++ is and probably will never be for the casual programmer.
I was not arguing to DO it. I was trying to give a scope of what is involved to discourage exactly that.

If you want to be the guy writing low level backbone libraries for an OS, the world needs some people doing this. Apparently microsoft has some openings about now (see, the last dozen idiotic and destructive updates for winx that have people going for their torches and pitchforks). Someone has to do it.

If you want to be that guy, you will need to get some deep hands on knowledge from books, web, documentation, everything you can get your hands on about how it is done, what is available to use to build it, how it all works. I can't help you; the last time I worked with anything like this was the old dos windows (remember those? Stuff like the edit program, that contained its own 'gui' of sorts, its own mouse interface and all??) and even there I had some libraries to use, it wasn't from scratch.
Yeah that's true, someone does have make/maintain it somewhere. And everything rots when not maintained.
thank you Ganado
Topic archived. No new replies allowed.