How to capture keypresses ?????

Does anyone know how to capture keypresses in Windows e.g. keys pressed in a password box ??? Any help appreciated


  • Well, lots of ways!

    - For password edit boxes, FindWindow() the box and then SendMessage(hWndEdit,EM_SETPASSWORDCHAR, 0L, 0L) to remove the passwordability.

    - This not sure 100% about, cant you send a WM_COPY to an edit box? Then get the content from clipboard. Maybe combined with the point above it will work.

    - Can always use a system wide hook and subclass the window you want, or just wait in WH_KEYBOARD and look for the keyboard strokes, GetForegroundWindow() retrieves the window this kbd message will go to. Note, system wide hooks must reside in a DLL, and use no thread ID but the DLL instance instead, other than that they are like normal hooks.


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!