While futzing around with the reverse engineering the BlackWidow, I came across xev — a piece of software that intercepts and prints to screen any mouse and keyboard event. Ive had a few situations where this would be useful in Windows.

How can I monitor for HID events in windows, the same way I would use xev or similar tools on linux?

closed as off-topic by DavidPostill, fixer1234, Ben N, mdpc, G-Man Nov 22 '16 at 5:12

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they become outdated quickly and attract opinion-based answers. Instead, describe your situation and the specific problem you're trying to solve. Share your research. Here are a few suggestions on how to properly ask this type of question." – DavidPostill, fixer1234, Ben N, mdpc, G-Man
If this question can be reworded to fit the rules in the help center, please edit the question.

  • There's a similar question on Server Fault, unfortunately none of the answers seem to work. – Gilles Jul 31 '13 at 9:52
  • The application Spy++ included in the Microsoft SDK is working fine for me. – Bemipefe Feb 12 at 12:07

I don't know what your exact requirements are, but AutoHotkey has two features, which enable you to display keyboard and mouse events; however these are focused for the usage in AutoHotkey itself and can be much too rudimentary for your problem:

  • To spy on keyboard events you need this minimal script (AutoHotkey.ahk):


    Then you can open AutoHotkey -> View -> Key History and script info and display the pressed keys. If you change the focus, this is logged also:

    Window: C:\Users\User\Documents\AutoHotkey.ahk - AutoHotkey v1.1.00.00
    Keybd hook: yes
    The oldest are listed first.  VK=Virtual Key, SC=Scan Code, Elapsed=Seconds
    since the previous event.  Types: h=Hook Hotkey, s=Suppressed (blocked),
    i=Ignored because it was generated by an AHK script, a=Artificial,
    #=Disabled via #IfWinActive/Exist, U=Unicode character (SendInput).
    VK  SC  Type    Up/Dn   Elapsed Key     Window
    4C  026     u   0.08    L               keyboard - Equivalent for xev on windows - Super User - Opera Next              
    4C  026     d   0.05    L               
    4C  026     u   0.09    L               
    4F  018     d   0.17    O               
    4F  018     u   0.08    O               
    20  039     d   0.16    SPACE               
    20  039     u   0.09    SPACE               
    A0  02A     d   0.05    SHIFT           
    53  01F     d   0.26    S               
    55  016     d   0.11    U               
    53  01F     u   0.02    S               
    55  016     u   0.08    U               
    50  019     d   0.03    P               
    50  019     u   0.11    P               
    45  012     d   0.05    E               
    45  012     u   0.16    E               
    52  013     d   0.08    R               
    52  013     u   0.08    R               
    55  016     d   0.13    U               
    55  016     u   0.08    U               
    53  01F     d   0.06    S               
    53  01F     u   0.13    S               
    45  012     d   0.13    E               
    45  012     u   0.13    E               
    52  013     d   0.11    R               
    52  013     u   0.09    R               
    A0  02A     u   1.00    SHIFT           
    A2  01D     d   10.56   CTRL            C:\Users\User\Documents    \AutoHotkey.ahk - AutoHotkey v1.1.00.00
    A2  01D     u   0.09    CTRL            
    A4  038     d   2.61    ALT             
    A4  038     u   0.06    ALT             
    A2  01D     d   0.47    CTRL            
    A5  138     d   0.00    ALT GR          
    A2  01D     u   0.11    CTRL            
    A5  138     u   0.00    ALT GR          
    A3  11D     d   1.09    CTRL-RIGHT      
    A3  11D     u   0.09    CTRL-RIGHT      
    5B  15B     d   0.92    LEFT WINDOWS    
    5B  15B     u   0.08    LEFT WINDOWS    
    74  03F     d   1.97    F5     
  • The Mouse spy (AutoHotkey Tray Icon -> Windows Spy) is limited to the coordinates, but detects also the active window:

    enter image description here


As already posted on ServerFault: my usual quick solution for this is keylook.exe.

Edit: ftp server is no longer working. Source code and exes can be downloaded from http://www.charlespetzold.com/books.html as http://www.charlespetzold.com/src/ProgWin5.zip

  • Interestingly, it dosen't work for the keys in question if they arn't mapped. This does seem handy but more information on keylook.exe would be nice - its kind of odd to have nothing but an FTP server - is there a proper website for this, and could you include what it does and how it might be useful in your answer? – Journeyman Geek Dec 3 '15 at 0:13
  • It is one of the example programmes accompanying the (originally for Windows 95) book "Programming Windows, 5th Edition" by Charles Petzold: <charlespetzold.com/books.html>. I use it for checking scan codes produced by keys in a virtual machine (I develop VirtualBox). – michaeljt Dec 4 '15 at 7:27

I haven't tried it, but there's xev for Cygwin.

  • 2
    This only reports keyboard events in an X session, not in Windows in general. – Gilles Jul 31 '13 at 9:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.