accelerator keys in win32 API
ive tried long and hard to get accelerator keys working, but its proved very difficult. i just cant see what im doing wrong.
i created an accelerator table with the MSVC resource editor. i added an accelerator. i defined the IDs. i added code before the message loop to load the table, and modified the message loop to translate accelerator messages. then i set up a capture in WM_COMMAND for the ID of the key. but nothing happens, no message is sent at all when i press the accelerator key. what could be wrong?
IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE
"Z", ACCEL_QUIT, VIRTKEY, CONTROL, ALT, NOINVERT
if ( (table=LoadAccelerators(hInstance,
// Step 3: The Message Loop
while(GetMessage(&Msg, NULL, 0, 0) > 0)
if(!TranslateAccelerator(Msg.hwnd, table, &Msg))
//these are at the very top of the source file
#define ACCEL_QUIT 10032
#define IDR_ACCELERATOR1 10033
thats all the code involved. are there any glaring errors there, or anything im doing wrong?
PostQuitMessage(0); return 0;