![]() g_bWindowActive is used to control if the Windows key is filtered by the keyboard hook or not. LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) Return CallNextHookEx( g_hKeyboardHook, nCode, wParam, lParam ) Note that this will not block the Xbox Game Bar hotkeys (Win+G, Win+Alt+R, etc.) LRESULT CALLBACK LowLevelKeyboardProc( int nCode, WPARAM wParam, LPARAM lParam )īEatKeystroke = (g_bFullscreen & g_bWindowActive & ((p->vkCode = VK_LWIN) || (p->vkCode = VK_RWIN))) G_hKeyboardHook = SetWindowsHookEx( WH_KEYBOARD_LL, LowLevelKeyboardProc, GetModuleHandle(nullptr), 0 ) INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int ) Using a low-level keyboard hook to disable the Windows key HHOOK g_hKeyboardHook = nullptr This method is used by DXUT and is illustrated in the following code example.Įxample 1. This method also works with least-privileged user accounts (also known as Standard User accounts). This method works on Windows 2000 and later versions of Windows. The code in Example 1 does this by handling the WM_ACTIVATEAPP message. This means that you must be careful to ensure that the Windows key is not disabled when the application is deactivated. The low-level keyboard hook shown in Example 1 remains in effect even if a user minimizes the window or switches to another application. ![]() Use a low-level keyboard hook to filter out the Windows key from being processed.
0 Comments
Leave a Reply. |