What is hwnd c




















Also play with other values to see what they do. Since we want to create a window from the class we just registered, we use the name of that class. After that we specify our window name or title which is the text that will be displayed in the Caption , or Title Bar on our window.

There are quite a few of these and you should look them up and experiment to find out what they do. These will be covered more later. Remeber that the left of the screen is an X value of zero and it increases to the right; The top of the screen is a Y value of zero which increases towards the bottom.

The units are pixels, which is the smallest unit a screen can display at a given resolution. In windows, the windows on your screen are arranged in a heirarchy of parent and child windows.

When you see a button on a window, the button is the Child and it is contained within the window that is it's Parent. The menu is NULL for now since we don't have one yet. The instance handle is set to the value that is passed in as the first parameter to WinMain. The creation data which I almost never use that can be used to send additional data to the window that is being created is also NULL.

If you're wondering what this magic NULL is, it's simply defined as 0 zero. Therefore you will possibly get warnings if you use NULL for integer values, depending on your compiler and the warning level settings. You can choose to ignore the warnings, or just use 0 instead. Number one cause of people not knowing what the heck is wrong with their programs is probably that they didn't check the return values of their calls to see if they failed or not.

CreateWindow will fail at some point even if you're an experianced coder, simply because there are lots of mistakes that are easy to make. Untill you learn how to quickly identify those mistakes, at least give yourself the chance of figuring out where things go wrong, and Always check return values!

However using the parameter passed into WinMain gives whoever is running your program to specify whether or not they want your window to start off visible, maximized, minimized, etc You will find options for these in the properties of windows shortcuts, and this parameter is how the choice is carried out.

Careers Careers. Learn about game development. Follow Us. Chat in the GameDev. Back to General and Gameplay Programming. General and Gameplay Programming Programming. Started by markdezonia March 26, PM. A pointer to a struct with one var thats not used? You have to have HWND why? Cancel Save. SiCrane It''s a 32 bit sized variable that you can''t do anything with except pass to windows functions. Treat it as an opaque type; don''t try to understand what goes on inside it. The OS knows what it is, and that''s good enough.

I love Big Brother. VolkerG The struct trick is only used so that you are forced to use the corect handle and prevents you from using another handle type instead. It''s a handle that manifests itself as either a pointer to a struct or a pointer to void. It doesn''t so much matter, as Windows handles it consistently internally. Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear.

TechnologyAdvice does not include all companies or all types of products available in the marketplace. Remember Me? Advanced Search. Results 1 to 1 of 1. Thread Tools Show Printable Version. November 4th, , AM 1. What 'unused' means? Is it an error in program?



0コメント

  • 1000 / 1000