在程序中得到不同的输入进行处理,同一个键在不同时候功能不同,用到了F1~F10,我用OnKeyDown();但f6和f10不起作用,该怎样得到?我不想用钩子,觉得有点麻烦,在这里用有点浪费

解决方案 »

  1.   

    ONCHAR 
    用钩子其实很方便,有别人写好的DLL调用一下就可以了
      

  2.   

    那哪位仁兄有低级键盘钩子的例程麻烦送个,先谢谢啦
    [email protected]
      

  3.   

    BOOL CExEdit::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if( pMsg->message == WM_KEYDOWN && pMsg->wParam == 13)//按下回车
    {

    }
    return CEdit::PreTranslateMessage(pMsg);
    }
      

  4.   

    CExEdit 是从cedit继承过来的,然后继承需函数
    virtual BOOL PreTranslateMessage(MSG* pMsg);用的时候,把你的编辑框绑定一个CExEdit 类型的变量就可以了!
      

  5.   

    F6可以,F10不行,可在对话框的PreTranslateMessage(MSG* pMsg) 做文章
    BOOL CTestDlg::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F6)//按下回车
    {
    MessageBox("F6");
    }
    return CDialog::PreTranslateMessage(pMsg);
    }
      

  6.   

    F10走的是WM_SYSKEYDOWN 路线
    if( pMsg->message == WM_SYSKEYDOWN && pMsg->wParam == VK_F10)
    {
    MessageBox("F10");
    }