關鍵:
MSG msg; int bRet = 1; while (bRet != 0) { if (PeekMessageW(&msg, (IntPtr)0, 0u, 0u, 0u) != 0) { if ((bRet = GetMessageW(&msg, (IntPtr)0, 0u, 0u)) != 0) { if (bRet == -1) { // handle the error and possibly exit } else { IntPtr h = GetAncestor(msg.hwnd, GA_ROOT); if (IsDialogMessageW(h, &msg) == 0 && TranslateAcceleratorW(h, (IntPtr)0, &msg) == 0) { TranslateMessage(&msg); DispatchMessageW(&msg); } } } } else { WaitMessage(); } }
原文地址:https://www.cnblogs.com/shitekudasai/p/9545536.html
时间: 2024-11-06 11:40:56