Equivalent for xev on windows [closed]

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):

    #InstallKeybdHook
    

    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. Executables are found inChap06 and then KeyView1/Release and KeyView2/Release.