你不用锁定啊你在onkeydown里自己处里键盘码
测试一下有number健的键盘码和没有number健的键盘码
然后映射为同一个
最不计了用键盘钩子

解决方案 »

  1.   

    BOOL CMyDlg::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if (pMsg->message == WM_KEYDOWN)
    {
    // CString str;
    // str.Format("%d", pMsg->wParam);
    // MessageBox(str);
    if (pMsg->wParam == 45) pMsg->wParam = 96;
    if (pMsg->wParam == 46) pMsg->wParam = 110;
    if (pMsg->wParam == 35) pMsg->wParam = 97;
    if (pMsg->wParam == 40) pMsg->wParam = 98;
    if (pMsg->wParam == 34) pMsg->wParam = 99;
    if (pMsg->wParam == 37) pMsg->wParam = 100;
    if (pMsg->wParam == 12) pMsg->wParam = 101;
    if (pMsg->wParam == 39) pMsg->wParam = 102;
    if (pMsg->wParam == 36) pMsg->wParam = 103;
    if (pMsg->wParam == 38) pMsg->wParam = 104;
    if (pMsg->wParam == 33) pMsg->wParam = 105;
    }

    return CDialog::PreTranslateMessage(pMsg);
    }快快给分吧!!!
      

  2.   

    我建议你用键盘的扫描码,LParam 的位16-23,不过扫描码值要你自己去查。 
      

  3.   

    好象有个函数叫SetKeyboardState()能够一直锁定NumLOck状态,怎么用我就不知道了