它是干什么的?按什么键能产生WM_SYSCHAR消息?

解决方案 »

  1.   

    应该是功能键 ALT, CTRL, Shift等组合的时候才会发送WM_SYSCHAR 
    好像直接自己定义系统热键也可以
      

  2.   

    The WM_SYSCHAR message is posted to the window with the keyboard focus
     when a WM_SYSKEYDOWN message is translated by the TranslateMessage 
    function. It specifies the character code of a system character key 
    — that is, a character key that is pressed while the ALT key is down.The WM_SYSKEYDOWN message is posted to the window with the keyboard 
    focus when the user presses the F10 key (which activates the menu bar) 
    or holds down the ALT key and then presses another key. It also occurs 
    when no window currently has the keyboard focus; in this case, the 
    WM_SYSKEYDOWN message is sent to the active window. The window that 
    receives the message can distinguish between these two contexts by 
    checking the context code in the lParam parameter.
      

  3.   

    Alt+字符键,注意:键盘消息是发给焦点控件的。
      

  4.   

    试了一下:
    单文档程序中CEditView可以按 alt+某键 响应WM_SYSCHAR
    但是对话框程序中的CEdit却不行。
    难道和某个窗口属性有关?
      

  5.   

    你是怎么试的?可以重载对话框类的PreTranslateMessage函数,在函数中判断WM_SYSCHAR消息。
      

  6.   

    消息被CDialog::PreTranslateMessage响应了,可以重载PreTranslateMessage来响应,如果要在Edit类的OnSysChar中响应,重载对话框类的PreTranslateMessage函数,判断消息为WM_SYSCHAR时return FALSE。
      

  7.   


    PreTranslateMessage可以收到WM_SYSCHAR消息,但是仍不好使,return TRUE或者FALSE都不行。什么原因?
    现在的解决方法是自己转发WM_SYSCHAR。 if( WM_SYSCHAR== pMsg->message)
    {
    //AfxMessageBox("PreTranslateMessage");
    SendMessage(WM_SYSCHAR, pMsg->wParam, pMsg->lParam);
    return TRUE;
    }
      

  8.   

    要return FALSE。你是重载的对话框类的PreTranslateMessage函数吗?
      

  9.   

    不是,重载编辑框的。return FALSE也不行。
      

  10.   

    重载编辑框的不行,我一直说的都是重载对话框的return FALSE。
      

  11.   

    重载对话框的PreTransMessage,return FLASE 
    WM_SYSCHAR,详细可以看下
    http://msdn.microsoft.com/en-us/library/aa922034.aspx
      

  12.   


    好使了。您能说说原因吗?编辑框的WM_SYSCHAR是由向导生成,其他的WM_SYSCHAR都是手工添加的。难道是微软的疏忽?
      

  13.   

    其实前面已经说了,消息被CDialog::PreTranslateMessage响应了。
      

  14.   

    CEdit::PreTranslateMessage是可以收到这个消息的。