Announcement

Collapse
No announcement yet.

Capture WM_KEYDOWN/KEYUP

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Capture WM_KEYDOWN/KEYUP

    Short of subclassing or creating a keyboard hook is there a way to capture wm_keydown/keyup in a child window that has no controls, is a child of a child PB dialog which itself is a child of a PB dialog and was created using registerclass()/createwindow()?

    The child window is styled %WS_CHILD OR %WS_CLIPCHILDREN OR %WS_CLIPSIBLINGS OR %WS_TABSTOP OR _
    %DS_CONTROL OR %WS_VISIBLE

    Walt Decker

  • #2
    Do you need to capture particular keys?

    Perhaps use GetAsyncKeyState or GetKeyState ?
    Rgds, Dave

    Comment


    • #3
      Yes, Mr. Biggs.

      I think I have found a solution. I have added ES_WANTRETURN to the style.

      I am using a CASE ELSE in the child win callback and check the handle for ES_WANTRETURN. If TRUE then I query getkeystate for VK_DOWN, VK_UP, VK_TAB, and VK_RETURN. If getkeystate is true I take the appropriate action.

      I have done some testing. So far it appears to be working. More checking tomarrow.
      Walt Decker

      Comment


      • #4
        Short of subclassing or creating a keyboard hook is there a way to capture wm_keydown/keyup in a child window that has no controls, is a child of a child PB dialog which itself is a child of a PB dialog and was created using registerclass()/createwindow()?
        I would say taking a hard look at my design might be a step in the right direction.
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          That may be, Mr. Mattias; however none of the win standard controls or common controls perform the way I want without subclassing or creating a keyboard hook. Therefore, I am attempting to build a control that will.
          Walt Decker

          Comment


          • #6
            That may be, Mr. Mattias; however none of the win standard controls or common controls perform the way I want without subclassing or creating a keyboard hook. Therefore, I am attempting to build a control that will.
            Maybe you could incorporate the keyboard interface into the window procedure of the custom control. There are a number of members' demos of "custom control" here for you to study/adapt. If you are looking for actual keyboard input or even "any key" when the control obtains the keyboard focus or even a click then this must be worth a look for you.

            And at the end of this you end up with ....
            Code:
              CONTROL ADD "walts_custom_control_class"  ...   ....
            .. which may prove a whole lot more straightforward to manage than the scenario you describe.

            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment

            Working...
            X