我没有运行规范的消息循环,那么有没有一种方法可以在我的消息处理处理程序中调用 TranslateMessage(或其等效项)?
基本上我需要WM_CHAR
消息,除非我可以调用 TranslateMessage,否则我不会收到这些消息。目前我有消息处理设置,但没有消息循环。
// Static window function called by Windows for message processing. Implementation
// delegates message processing to MemberWndProc.
LRESULT CALLBACK FxPlayerTiny::WindowsMsgStatic(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
msg = PeekMessage(&msg, HWnd, WM_KEYFIRST, WM_KEYLAST, PM_NOREMOVE);
if (msg type is key down){
TranslateMessage(&msg);
//DispatchMessage(&msg); -- needed?
}
else process msg normally
}
我的消息 proc 处理程序是消息的第一个入口点,以下列方式设置:
WNDCLASSEX wc;
wc.lpfnWndProc = WindowsMsgStatic;
....
RegisterClassEx(&wc);