WM_HOTKEY never passes dlgproc

I try to register ctrl+click key and ctrl+numkeys.


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

void OnWM_Create(HWND window, CREATESTRUCT * cs)
{
  int i;

  RegisterHotKey(window,1, MOD_CONTROL | MOD_NOREPEAT, VK_LBUTTON );
  for ( i = 48; i<58; i++ ) 
    RegisterHotKey(window,i, MOD_CONTROL | MOD_NOREPEAT, i );

...
}

LRESULT CALLBACK MapWndProc(HWND window, UINT msg, WPARAM wParam, LPARAM lParam)
{
  LRESULT ret = 0;
  int i;

  switch (msg)
  {
  case WM_CREATE:
    ret = 0;
    OnWM_Create(window, (CREATESTRUCT*)lParam);
    break;

  case WM_HOTKEY:
    data.ctrlPressed = true;
    data.initiatedCount++;
		break;

	// New feature: map selection
  case WM_LBUTTONDOWN:
  ...


it never passes throuth the case WM_CREATE: ... but I can pass case WM_LBUTTONDOWN:.

How to solve this?
Last edited on
> it never passes throuth the case WM_CREATE

WM_INITDIALOG https://msdn.microsoft.com/en-us/library/windows/desktop/ms645428(v=vs.85).aspx
Thank you, but the message WM_INITDIALOG is never processed. I can run the function from
case WM_CREATE:
...
I believe that is it not important in which part of the code I run the function, but it must be after the window has been created, and it was.

I have found that
1
2
3
4
bool res;
  res = RegisterHotKey(window,1, MOD_CONTROL | MOD_NOREPEAT, VK_LBUTTON );
DWORD dw = GetLastError(); 

result is false, getlasterror returns error code 1008

ERROR_NO_TOKEN

1008 (0x3F0)

An attempt was made to reference a token that does not exist
Last edited on
> WM_HOTKEY never passes dlgproc
>> Thank you, but the message WM_INITDIALOG is never processed

Isn't this a dialog procedure?


> getlasterror returns 1008
> How can I found meaning of the error?

If you are using Visual Studio, Menu => Tools => Error Lookup

winerror.h
1
2
3
4
5
6
7
8
//
// MessageId: ERROR_NO_TOKEN
//
// MessageText:
//
// An attempt was made to reference a token that does not exist.
//
#define ERROR_NO_TOKEN                   1008L 


I've absolutely no idea what that particular error means in this context.
My mistake, the code is

ERROR_INVALID_FLAGS

1004 (0x3EC)

Invalid flags.

Reason found:

Minimum supported client
Windows Vista [desktop apps only]

I have XP
Last edited on
Topic archived. No new replies allowed.