怎么响应关闭窗口的消息,也就是退出程序!
当达到某种状态时,我想调用一个函数直接退出程序,怎么做?哪里去响应关闭窗口的消息???
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_SIZE:
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_MOUSEMOVE:
case WM_PAINT:
case WM_DESTROY:
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
是这个吗?