How to use accelator key with a dialogbox based win32 program in C?

Started by codamateur, August 28, 2007, 02:27:47 AM

Previous topic - Next topic

codamateur



ACCEL hotk={FCONTROL,VK_T,199}; (i have also tested with 't' ,'T')

switch(Message)
   {
      case WM_INITDIALOG:
                (...)
                haccel=CreateAcceleratorTable(&hotk,1);
                if(haccel==0) MessageBox(0,"error","error",MB_OK | MB_ICONERROR);
                (...)
                case WM_COMMAND:
             switch(LOWORD(wParam))
             {
                  case 199:
                  MessageBox(0,"ok","ok",MB_OK | MB_ICONERROR);
                  return 0;
                  (...)

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
        DialogBox(hInst,MAKEINTRESOURCE(DIALOG_1),0,DlgProc);
        return 0;
}

the messagebox doesnt appear when both key control +t are pressed
and CreateAcceleratorTable seems successfull

any idea?



JohnF

It's not straight forward, here is an article about the issues.

http://www.codeguru.com/cpp/w-d/dislog/tutorials/article.php/c4965/

You may find more by using Google.

John