Pelles C forum

C language => Windows questions => Topic started by: codamateur on August 28, 2007, 02:27:47 AM

Title: How to use accelator key with a dialogbox based win32 program in C?
Post by: codamateur on August 28, 2007, 02:27:47 AM


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?


Title: Re: How to use accelator key with a dialogbox based win32 program in C?
Post by: JohnF on August 29, 2007, 03:51:29 PM
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