怎样才能把"F5"设置为热键,不加Alt,Ctrl.Shift.

解决方案 »

  1.   

    设置热键(加速键)的方法:
    在你的工作区的ResourceView页面中,打开Accelerator项,双击其子项则在右边会显示所有的加速键,双击最后的空白处可以添加,在弹出的对话框中,将Alt、Ctrl、Shift前面的三个复选框不选中,在ID下拉列表中输入你的热键所对应的ID号,然后在Key下拉列表中选择VK_F5就可以了
      

  2.   

    或 BOOL RegisterHotKey(
      HWND hWnd,         // window to receive hot-key notification
      int id,            // identifier of hot key
      UINT fsModifiers,  // key-modifier flags
      UINT vk            // virtual-key code
    );
    msdn上有说明;
    当然还要加消息处理函数:
    virtual BOOL PreTranslateMessage( MSG* pMsg )
    {
    if(pMsg->message==WM_HOTKEY)
    {
      //DO WHAT YOU WANT TO DO!
    }
    }
      

  3.   

    VK_F5  是这个 但是你加给谁设热键呢?/
      

  4.   

    #define IDC_HOTKEY 1005
    OnCreate  :
    ::RegisterHotKey(m_hWnd,IDC_HOTKEY,NULL,VK_F5);
    WM_DESTORY ::UnregisterHotKey(this->m_hWnd,IDC_HOTKEY);BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) 
    { if(pMsg->wParam==IDC_HOTKEY)
     .......
          return CMDIFrameWnd::PreTranslateMessage(pMsg);
    }