if (!IsDialogMessage(g_hWnd, &msg)) // Дополнительное условие { TranslateMessage(&msg); DispatchMessage(&msg); }