在EDIT控件中,按动键盘上/下箭头键会增减EDIT中的数字。
请问,如何在CSpinButtonCtrl中截获键盘的上/下箭头键的消息?*查阅MSDN:提示需处理WM_KEYDOWN/WM_KEYUP,但是却没有任何消息流经此处。
          (鼠标消息可截获即WM_LBUTTONDOWN/WM_LBUTTONUP)。

解决方案 »

  1.   

    我要的不是 UDN_DELTAPOS 消息,而是想知道何时上、下箭头键被按下/弹起。
      

  2.   

    那你只能重载一个CSpinButtonCtrl类了,自己处理所有的标准的windows消息
      

  3.   

    你试一试将
        ON_MESSAGE(WM_LBUTTONDOWN, OnLBtnDown)
        ON_MESSAGE(WM_LBUTTONUP, OnLBtnUp)
    替换成
        ON_MESSAGE(WM_LBUTTONDOWNA, OnLBtnDown)
        ON_MESSAGE(WM_LBUTTONDOWNW, OnLBtnDown)
        ON_MESSAGE(WM_LBUTTONUPA, OnLBtnUp)
        ON_MESSAGE(WM_LBUTTONUPW, OnLBtnUp)
    在调试试试!
      

  4.   

    The UDN_DELTAPOS notification is sent before the WM_VSCROLL or WM_HSCROLL message, which actually changes the control's position. This lets me examine, allow, modify, or disallow the change. The UDN_DELTAPOS is processed as reflected message. If new position of spin control is the same as previous one, what can happen only when user clicked a disable arrow, then the handler eat UDN_DELTAPOS message. Otherwise the control updates its state, depending on its new position and let UDN_DELTAPOS to be processed by system.