Originally Posted by
Benji Wiebe
Anyone have any ideas as to why this is happening?
Yep... your accellerator table is malformed... only the first and second lines are correct.
Accelerator Tables (Windows)
The correct format is ... key, command value, type, options
"^o" does not identify shifted O... you need to add the SHIFT option to the line, instead.
Code:
"O", 1200, ASCII, SHIFT
You should also know that when you are using accelerators you have to modify your windows message dispatcher... For accelerators in dialogs it will end up looking something like this...
Code:
while( GetMessage(&Msg, hWND, 0, 0) > 0 )
if ( ! TranslateAccellerator( hWND, hAccellTable,&Msg) )
if ( ! IsDialogMessage( hWND, &Msg) )
{ TranslateMessage( &Msg);
DispatchMessage( &Msg); }
Finally, you should, whenever possible, use the default windows keyboard processing of certain keys...
For example:
WM_HELP is issued when the user presses F1
WM_CONTEXTMENU is issued when the user presses the menu key
WM_COMMAND is issued with the value IDOK when the user presses Enter
WM_COMMAND is issued with the value IDCANCEL when the user presses Esc
And, finally, for reference here's a copy of a working table....
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
}