phkev.exe: echo windows keyboard events to console
[page last modified 2019-12-31]

This is a Windows program that echoes keyboard keystroke event info to the console in hex as keys are pressed (and optionally released).

The info is echoed as a hex number whose bit fields are as follows:

	Key Down		(25)
	Enhanced Key		(24)
	Caps Lock On		(23)
	Scroll Lock On		(22)
	Num Lock On		(21)
	Shift			(20)
	Left Ctrl		(19)
	Right Ctrl		(18)
	Left Alt		(17)
	Right Alt		(16)
	Translated Ascii	(15..8)
	Virtual Key Code	 (7..0)

By default only key downstrokes are echoed until an <Esc> is entered.

Options that can be added to the command line:

    phkev /			include key release events
    phkev *			do not display event, return it as program exitcode

The * mode will return immediately upon the first event (which is not echoed in hex).  An example of its use:

    set errorlevel=& phkev *
    echo %errorlevel%
    33561371

The usefulness of * might be, via some .bat set /a arithmetic, to isolate the scancode and check for user input of a special character (like a function or arrow key).

The single Microsoft C source file phkev.c is included.  Instructions how to build it are within the source.


Change Log

12/31/2019  Original release.

Click here to download  phkev191231.zip


Widget is loading comments...

You are visitor 1720       Go to Home Page