Win32 drawing a custom class window causes the resolution of drawing 11 windows

Source: Internet
Author: User

On the Internet to check a lap and did not find a solution to the problem, once created a window, and in the process function to draw the window, especially some non-child window of the custom Class window, will generate 11 windows (count the main window is 12), but the use of the system universal control will not happen, And the process of drawing is written in wm_create, then it can be indirectly proved that after the program is initialized to know that the main window is displayed, the process sent a total of 11 wm_create messages. Assuming this is the case, then how does the control using the system not happen? In this way, when the main window is created, the custom class is initialized, and the main window corresponds to a unique procedure function, then creating a window with its own type within its procedure function will send the corresponding message to the procedure function, thus looping through the creation of the window. If so, but why would it be 11, not more or less? Try to check the number of parameters CreateWindowEx need, exactly 12, counting itself is 12 windows, through the experiment, regardless of which combination, register the class and use the class to create a window will produce 11 satellite windows, regardless of its parameters. So the registration of which class for why it has no effect, I think so, regardless of whether to use RegisterClass or registerclassex, the system will allocate the larger memory, so that Windows can be backward compatible, for example, Originally using RegisterClass in an earlier version of the function is all right, but to the newer system still use the function, the system will assign him the new function required memory size, so that even if the original code does not need to be modified, the original library can adapt to the new system and call.

Interestingly, if you use the new window style to create additional windows, the new window will use the new style without invalidating the style of the main window.


Workaround: The new window must use another procedure function, that is, declare a new procedure function in the class, as for the use of Setclasslong or SetWindowLong in a new window I have not tried ...

Win32 drawing a custom class window causes the resolution of drawing 11 windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.