加速键不起作用
问题描述:
我在Visual Studio 8(它是一个资源管理器样式的应用程序)中创建了一个MFC SDI项目.它具有在Accelerator文件夹的资源视图中定义的加速键.分配给加速键的ID与它们相应的菜单项具有的ID匹配.
选择菜单项时,消息ID会导致调用正确的方法.但是,当按下加速键时,什么也没发生.
为什么是这样?我缺少什么吗?
I have an MFC SDI project vreated within Visual Studio 8 (it is an explorer style app). It has accelerator keys defined in the resource view within the Accelerator folder. The IDs assigned to the accelerator keys match the IDs that their corresponding menu items have.
When the menu items are chosen, the message ID causes the correct method to be called. But when the accelerator keys are pressed, nothing happens.
Why is this? Am I missing something?
答
case WM_COMMAND:
{
int idCommand = LOWORD(wParam);
int iNotifyCode = HIWORD(wParam); // 1==accelerator
switch(idCommand)
{
case ID_QUIT: /* do anything */ break;
/* do something else */
}
}
break;
问候.