Capturing keystrokes
Paul Freund
freund.paul at lvl3.org
Fri Feb 7 04:32:24 PST 2014
On Friday, 7 February 2014 at 12:17:42 UTC, Chris wrote:
> Just out of interest, is there a way of capturing keystrokes in
> D? E.g. if you have a CLI application that wants to capture
> Ctrl+... and the like, and possibly control the cursor.
You can achieve this by interfacing operating system functions.
If your target is windows you can take a look at my ScrollLocker
project (https://github.com/PaulFreund/ScrollLocker). It is
written in D and uses SetWindowsHookEx and WH_KEYBOARD_LL (low
level keyboard hook) to capture key strokes (see helper/hooks.d).
There should be similiar facilitys in other OS as well.
It should also be possible to get certain combinations in the
cmd/shell but I don't know how.
More information about the Digitalmars-d
mailing list