hi, i am trying to learn how to use accelerators.
Here's what i have done so far
in my main message loop :
Code:
HACCEL haccel = LoadAccelerators( GetModuleHandle(0), MAKEINTRESOURCE(IDC_AINTERFACE) );
while(GetMessage(&Msg, NULL, 0, 0) > 0)
{
TranslateAccelerator(calc_hwnd, // handle to receiving dialog right? haccel, // handle to active accelerator table
&Msg) ; // message data */
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
For calc_hwnd's callback function, where there's a problem
Code:
BOOL CALLBACK calcproc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
{
SendDlgItemMessage(hwnd,IDC_HOUR, EM_SETLIMITTEXT, (WPARAM)2,0);
SendDlgItemMessage(hwnd,IDC_MIN, EM_SETLIMITTEXT, (WPARAM)2,0);
break;
}
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
/* case IDOK:
EndDialog(hwnd, IDOK);
break;
case IDCANCEL:
EndDialog(hwnd, IDCANCEL);
break;*/
case IDM_TAB:
{
int a = 5; // !!PROBLEM PROBLEM !! : here where a doesnt become 5 because no "IDM_TAB" message was received.
}
break;
case IDC_EXIT:
{
EndDialog(calc_hwnd, IDOK);
EnableWindow(dia_hwnd, TRUE);
break;
}
}
break;
default:
return FALSE;
}
return TRUE;
}
The name of my accelerator resource is IDC_AINTERFACE.
I defined it such that the ID "IDM_TAB" has key "VK_TAB" of type "VIRTKEY"
I believe there's something very wrong with this. can anyonoe pls correct me?
using
- win 98se
- API Style
- vc++6.0