phkev.exe: echo windows keyboard events to console
[page last modified 3/1/2019]

This is a Windows program that echoes keyboard keystroke event info to the console in hex as a key is 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:

    C>phked /			include key release events
    C>phked *			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:

    C>set errorlevel=&phked *
    C>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 .exe was compiled w/MSFT cl ver 13.10.3077 (7.1) via:

    C>cl /Oxb0 phkev.c /link /merge:.data=.text /merge:.rdata=.text /entry:main /filealign:512

You'll get a warning about merging unalike sections; that's expected.   The program can be compiled with a more recent compiler, or 64-bit, but the resulting .exe will be larger.


Change Log

3/1/2019  Original release.

Click here to download  phkev190301.zip


Widget is loading comments...

You are visitor 916       Go to Home Page