아마도 일종의 총체적 감시 일 뿐이지 만 메시지 루프에는 WM_SIZE 메시지가 수신되지 않습니다. 그러나 나는 그들을 WndProc에서 받는다. Windows 루프가 WndProc에 메시지를 보냈다고 생각 했나요? 는 Windows 메시지 큐가의 그 지하 세계의 다른 곳에서 DefWindowProc를 지나온에 나있는 동안 메시지가 당신의 창에 시스템에 의해 전송되는 경우Windows 메시지 Bizarreness
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
// this message is read when the window is closed
case WM_DESTROY:
{
// close the application entirely
PostQuitMessage(0);
return 0;
} break;
case WM_SIZE:
return 0;
break;
}
printf("wndproc - %i\n", message);
// Handle any messages the switch statement didn't
return DefWindowProc (hWnd, message, wParam, lParam);
}
... 지금은 메시지 루프 ...
while(TRUE)
{
// Check to see if any messages are waiting in the queue
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
// translate keystroke messages into the right format
TranslateMessage(&msg);
// send the message to the WindowProc function
DispatchMessage(&msg);
// check to see if it's time to quit
if(msg.message == WM_QUIT)
{
break;
}
if(msg.message == WM_SIZING)
{
printf("loop - resizing...\n");
}
}
else
{
//do other stuff
}
}
또한 ... 자신의 창 UI 스레드가 자체적으로 (예 : 다른 메시지 처리 중일 때) 대기열에 들어 가지 않는 명시 적 또는 암시 적 SendMessage를 수행하면 몇 가지 내부 기능을 거쳐 결국 WndProc 직접. 그래서 WM_CREATE에 SetWindowText를 사용할 수 있습니다. – martona
게시 된 메시지와 보낸 메시지의 +1 : SendMessage는 메시지를 직접 windowproc에 전달합니다. –