hello everybody !
I have a problem to add keyboard accelerators to my WIN32 (no MFC) application. I did all the API documentation said but does not work !!
here is an extract of the code i am using in the main function of the application:
//******************************************
ACCEL tabla[2]; // array for store accelerator info
HACCEL h_tabla; // handle for accelerator table
// load accelerator info
tabla[0].fVirt = FVIRTKEY;
tabla[0].key = VK_F5;
tabla[0].cmd = 1001;
tabla[1].fVirt = FVIRTKEY;
tabla[1].key = VK_F6;
tabla[1].cmd = 2001;
// create accelerator table
h_tabla = CreateAcceleratorTable(tabla,2);
while (GetMessage(&msg, (HWND) NULL, 0, 0)) {
if (!TranslateAccelerator(hwndMain, h_tabla,&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
//*******************************
when i press F5 or F6 nothing happen, through i capture de WM_COMMAND message. i try to do this using the function LoadAccelerators and an accelerator table resource and worked OK !! so the problem is with the run-time way, isn't it? and i need to do it with out resources !!
p.d. Sorry about my english