用RegisterHotKey注册你想截获的键盘输入,相应WM_SYSCOMMAND即可!

解决方案 »

  1.   

    You can use a dll file to hook the keyboard operation, Use SetWindowHookEx() to hot the keyboard operation(KEYBOARD_II), If pressed key is F1,F2,F3, You can posemessage(the message you can define by youself) to you Application, Then you can do everything on you aplicaiont.
      

  2.   

    Holly is almost right, but what you should intercept is WM_HOTKEY. I think it's just a typing mistake here.
      

  3.   

    Sorry! Paste Error!
    提供完整的做法!
    以CMainFrame为例:
    声明成员变量:
        int m_nHotKey;
    在CMainFrame::OnCreate中:
        m_nHotKey = GlobalAddAtom("Hotkey for MyApp!"); //取得唯一的注册键ID;
        // 以左边的WINDOWS键为例!
        if (!RegisterHotKey(GetSafeHwnd(), m_nHotKey, MOD_WIN, VK_LWIN))
        {
            DWORD dwError = GetLastError();
            //处理失败!
            ...;
        }
    在CMainFrame::OnClose中:
        UnregisterHotKey(GetSafeHwnd(), m_nHotLWin);在消息映射表中增加:
        ON_MESSAGE(WM_HOTKEY, OnMyHotKey)添加成员函数:
        afx_msg void OnMyHotKey(WPARAM wParam, LPARAM lParam);void CMainFrame::OnMyHotKey(WPARAM wParam, LPARAM lParam)
    {
        if(wParam == m_nHotLWin)
            AfxMessageBox("You have catch left win key successfully!");
    }
      

  4.   

    用两句汇编只接监控键盘口:
          mov al, 60h
          mov b, al
    b中为按下的键的代码,不过不是ASCII,你可以自己看看规律。