keybd_event KEYEVENTF_EXTENDEDKEY explanation required



In documentation it says:

KEYEVENTF_EXTENDEDKEY (0x0001): If specified, the scan code was preceded by a prefix byte having the value 0xE0 (224).

Can someone explain what this means?

What is the difference between this:

keybd_event(RIGHT, 0, 0, 0);
keybd_event(RIGHT, 0, 2, 0);

and this:

keybd_event(RIGHT, 0, 1 | 0, 0);
keybd_event(RIGHT, 0, 1 | 2, 0);

because when I execute this code I can’t see no difference?

Also, what is “byte bScan” for? In description it is: A hardware scan code for the key. What that means?





The simple (and incomplete) explanation is that KEYEVENTF_EXTENDEDKEY means “this keystroke is from the numeric keypad”

Since most programs behave the same if you hit ‘1’ above the ‘q’ key as they do when you hit ‘1’ on the numeric keypad (which is an extended key) – you wouldn’t normally expect to see any difference when you set this flag when simulating keyboard input.

Programs that pay attention to the location of a key will usually respond to this flag.

The bScan value is a raw hardware scancode. For an explanation of scancodes look here Like the Extended key flag, most programs pay no attention to scancodes. The values are there in case the program wants to treat the keyboard as a bunch of buttons.


Facebook Comments

Post a comment