【发布时间】:2011-06-21 01:36:52
【问题描述】:
如果我有以下代码,如何检测窗口何时关闭,以便退出? r 似乎永远不会得到值 -10,我需要处理整个线程的消息,而不仅仅是当前窗口。
HWND hWnd = CreateWindowExW(0, L"Edit", L"My Window", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 300, 200, NULL, NULL, NULL, NULL);
ShowWindow(hWnd, SW_SHOWDEFAULT);
MSG msg;
BOOL r;
while ((r = GetMessageW(&msg, NULL, 0, 0)) != 0)
{
if (r == -1) { break; }
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
【问题讨论】:
标签: c winapi window message-loop