1

I am new to Windows programming. On Windows OS, almost every application opens a window, and I want to know that if all these applications invoke the same API CreateWindow() to create their windows?

Or, another way to ask my question: Do Games, Music Players, Browsers, Instant Messaging, IDEs, etc create their window all by invoking API CreateWindow()? If not, what other APIs can be used to create a windows on Windows?

1 Answer 1

3

Yes, that and CreateWindowEx are the only APIs that can create a window (other related APIs such as DialogBox and AllocConsole also do this internally). No matter what graphics stack each application uses (WPF, DirectX etc) in the end it all boils down to a CreateWindow.

Sign up to request clarification or add additional context in comments.

10 Comments

@rkosegi: Edited to mention that too. Thanks for the tip.
@Bloodmoon: Beware -- just because CreateWindowEx is able to create a window doesn't mean you should use it! It takes a lot of work to make the window actually usable -- you have to use IsDialogMessage, you have to change the font to the system default, you have to create the child windows properly (its own can of worms), etc... it's something you probably don't want to do manually in C unless you have to!
@Mehrdad:thanks for your reminder, actually I just want to confirm that all the windows applications, especially games, will invoke the 'CreateWindow' API, and I will not call it by myself. In fact, I want to hook this API, therefore I do not care about the values of the arguments.
Why hook that call directly? There are higher lever hook methods that pick up on window creation. It's also a very good idea to fully understand the Win32 window and API structure before trying to hook into it.
@Deanna: do you know any high level APIs that can creat a window? And why cannot I hook 'CreateWindow' directly? What negative effects will this hook bring?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.