自制的控件,在ONKEYDOWN和ONCHAR里都仅有一个对话框语句,敲键盘他们都能显示,ONCHAR的对话框显示在ONKEYDOWN前,可是如果去掉ONKEYUP里的对话框语句,ONCHAR也失效了,那位高人给解释一下

解决方案 »

  1.   

    OnKeyDown是所有键盘按下去都会触发,OnChar紧紧是可见字符的按键
      

  2.   

    OnKeyDown是所有键盘按下去都会触发,OnChar紧紧是可见字符的按键
      

  3.   

    The onkeydown event handler handles an event that occurs when a key is pressed.
      

  4.   

    This method is called by the framework when a nonsystem key is pressed. A nonsystem key is a keyboard key that is pressed when the ALT key is not pressed or a keyboard key that is pressed when CWnd has the input focus. afx_msg void OnKeyDown(
    UINT nChar,
    UINT nRepCnt,
    UINT nFlags );This method is called by the framework when a keystroke translates to a nonsystem character. This method is called before the OnKeyUp method and after the OnKeyDown method are called. OnChar contains the value of the keyboard key being pressed or released. Because there is not necessarily a one-to-one correspondence between keys pressed and OnChar calls generated, the information in nFlags is generally not useful to applications. The information in nFlags applies only to the most recent call to the OnKeyUp method or the OnKeyDown method that precedes the call to OnChar.afx_msg void OnChar(
    UINT nChar,
    UINT nRepCnt,
    UINT nFlags );
    CWnd类中!