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)