1. Re: Key Codes (Keystrokes in Win32)
There is a procedure in the Win32 API called keybd_event in user32.dll.
Here is the information on it from the Win32 Programmer's Reference. You
can get the whole file from the Euphoria archive.
keybd_evend synthesizes a keystroke, which can be used by the system to
generate WM_KEYUP or WM_KEYDOWN messages.
The way it is defined in C is:
VOID keybd_event(BYTE bVk, // virtual key-code
BYTE bScan, // hardware scan code
DWORD dwFlags, //flags specifying various function options
DWORD dwExtraInfo) // additional data associated with the keystroke
bVk
Specifies a virtual-key code. The code must be a value in the range 1 to
254.
bScan
Specifies a hardware scan code for the key.
dwFlags
A set of flag bits that specify various aspects of function operation.
An
application can use any combination of the following predefined constant
values to set the flags:
Value Meaning
KEYEVENTF_EXTENDEDKEY If specified, the scan code was
preceded by a
prefix byte having the value 0xE0 (224). KEYEVENTF_KEYUP
If specified,
the key is being released. If not specified, the key is
being depressed.
dwExtraInfo
Specifies an additional 32-bit value associated with the key stroke.
in Euphoria, I think it would be defined like this, but I am not sure...:
constant KEYEVENTF_EXTENDEDKEY =3D #1
constant KEYEVENTF_KEYUP =3D #2
constant user32 =3D open_dll("user32.dll")
constant keyboard_event =3D define_c_proc((user32, "keybd_event", {C_UCHAR,
C_UCHAR, C_LONG, C_LONG})
The C_LONGs might be C_ULONGs, but I am not sure...