Problems with a keyboard shortcut

Hello,
Lately I have been trying hard to solve my problem.

I try do deny a key combination of Win + L in my game. It worked so far with the GetAsyncKeyState() function. But the problem with it is that it can easily be circumvented, because i can press Win first and wait untill he has checked if L is pressed to and press L after its checked. So I have to check to Keys which can be pressed in to differnt times which obviously doenst work with the GetAsyncKeyState() function.

Here is my SC:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
LRESULT CTClientApp::KeyHookProc( int nCode, WPARAM wParam, LPARAM lParam)
{
 if( nCode < 0 )
  CallNextHookEx( m_hHook, nCode, wParam, lParam );

 if( wParam == WM_KEYDOWN )
 {
  PKBDLLHOOKSTRUCT pKey = (PKBDLLHOOKSTRUCT) lParam;


   
{           
    if (RegisterHotKey(
        NULL,
        1,
        MOD_WIN,
        0x4C))  //0x42 is 'b'
    {
        MessageBox(NULL, NULL, NULL, NULL);
    }
 
    return 0;
}
   //bool bCtrlDown = ( GetAsyncKeyState( VK_LCONTROL ) & 0x8000 || GetAsyncKeyState( VK_RCONTROL ) & 0x8000 );
   //bool bAltDown = ( GetAsyncKeyState( VK_LMENU ) & 0x8000 || GetAsyncKeyState( VK_RMENU ) & 0x8000 );
   //bool bL = ( GetAsyncKeyState( 0x4C ) & 0x8000);
    do
    {
		break;
			 CTClientGame* pGame = CTClientGame::GetInstance();
			 CTClientSession* pSession = pGame->GetSession();
	
			if( pSession )
			{
			pSession->SendCS_ACDCLOSE_REQ( 3 );
			m_bKeyDownCAD = TRUE;
			}
		
	} while (pKey->vkCode == VK_LWIN && pKey->vkCode == 0x4C);
  }
 return CallNextHookEx( m_hHook, nCode, wParam, lParam );
}
( I have played around a bit, so do not be irritated.)

Hope for a quick reply.

Thanks ahead.
Topic archived. No new replies allowed.