Is there any difference if I add a window handle or a null value

I have a little problem. First I will show you an example, then I will tell you what the problem is.

Example:

while(GetMessage(&msg, NULL, 0, 0)){
   TranslateMessage(&msg);
   DispatchMessage(&msg);
}

This example works correctly, but if parameter 2 in the "GetMessage" function has changed to the window handle name as follows:

Example 2: after a change

while(GetMessage(&msg, Hwnd, 0, 0)){
   TranslateMessage(&msg);
   DispatchMessage(&msg);
}

When you exit the program there will be a small problem. nevertheless, the program works in the list of processes. And you need to select it, then click the end button to complete the program

And now, is there a difference between add (NULL or a window handle)?

+3
source share
2 answers

, , , , , , GetMessage(), . , ( GetLastError() ERROR_INVALID_WINDOW_HANDLE), .

MSDN GetMessage() while (GetMessage(...)).

+5

- , . , . , , . . , , . , , .

0

All Articles