The operation is correct, but the window is not displayed. -- is the return value of CreateWindow in Windows Programming empty?

Source: Internet
Author: User

 

I wrote some code today. Below is a part.

There is no running error, but no window is created. Therefore, debug finds that the return value of hwnd, that is, CreateWindow, is null.

Why? After thinking for a long time, I also found a lot of information online.

Finally, it was found that the lresult callback WindowProc function of the window process was written incorrectly, so the error was corrected step by step (a very watery error was not posted ). The last operation is successful. The window is displayed normally!

 

// Create a window
HWND hwnd;
Hwnd = CreateWindow (_ T ("myClassName"), _ T ("my Window Name"), WS_OVERLAPPEDWINDOW,
0, 0,600,500, NULL, NULL, hInstance, NULL );
If (! Hwnd )//
{
MessageBox (NULL, _ T ("Call to CreateWindow failed! "), _ T (" Win32 Guided Tour "), NULL );
Return 1;
}

 

Error: hwnd is empty. Generally, it is because the lresult callback WindowProc of the window process function has a problem !!!

Or the memory is insufficient (? To be studied)

Related Article

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.