Usually accelerator tables are processed like this...
Code:
while(GetMessage(&msg, NULL, 0, 0))
{ if (!TranslateAccelerator(win,KeyBrd,&msg))
if (!IsDialogMessage(win,&msg))
{ TranslateMessage(&msg);
DispatchMessage(&msg); }
You create them in your resources like this...
Code:
HOTKEYS ACCELERATORS
{
80, 1000, VIRTKEY
VK_SPACE, 1001, VIRTKEY
83, 1002, VIRTKEY
VK_PRIOR, 1003, VIRTKEY
VK_NEXT, 1004, VIRTKEY
VK_LEFT, 1005, VIRTKEY
VK_RIGHT, 1006, VIRTKEY
VK_UP, 1007, VIRTKEY
VK_DOWN, 1008, VIRTKEY
49, 1009, VIRTKEY
50, 1010, VIRTKEY
51, 1011, VIRTKEY
52, 1012, VIRTKEY
VK_RETURN, 1013, VIRTKEY
84, 1014, VIRTKEY
88, 1015, VIRTKEY
}
That is ... KEY, CMD, FLAGS...
Of course you have to load the accelerator table on startup...
Code:
HACCEL KeyBrd;
// start accelerators
KeyBrd = LoadAccelerators(PgmInst,"HOTKEYS");
From there... it should work...
From the example... Pressing the Space bar should result in a WM_COMMAND message with 1001 in the low word of WPARAM, sent to the window specified in TranslateAccelerators().