| 1 |
{%MainUnit ../castlewindow.pas} |
| 2 |
|
| 3 |
{ WinAPI SendInput and related structures definition, |
| 4 |
missing from stable FPC, |
| 5 |
copied from FPC bugreport https://bugs.freepascal.org/view.php?id=35064 |
| 6 |
} |
| 7 |
|
| 8 |
const |
| 9 |
INPUT_MOUSE = 0; |
| 10 |
INPUT_KEYBOARD = 1; |
| 11 |
INPUT_HARDWARE = 2; |
| 12 |
|
| 13 |
{-------------------------------------} |
| 14 |
{ mouse input structure definition } |
| 15 |
|
| 16 |
type |
| 17 |
MOUSEINPUT = record |
| 18 |
dx : long; |
| 19 |
dy : long; |
| 20 |
MouseData : DWORD; |
| 21 |
Flags : DWORD; |
| 22 |
Time : DWORD; |
| 23 |
ExtraInfo : pointer; |
| 24 |
end; |
| 25 |
PMOUSEINPUT = ^MOUSEINPUT; |
| 26 |
|
| 27 |
{-------------------------------------} |
| 28 |
{ keyboard input structure definition } |
| 29 |
|
| 30 |
type |
| 31 |
KEYBDINPUT = record |
| 32 |
Vk : word; |
| 33 |
Scan : word; |
| 34 |
Flags : DWORD; |
| 35 |
Time : DWORD; |
| 36 |
ExtraInfo : pointer; |
| 37 |
end; |
| 38 |
PKEYBDINPUT = ^KEYBDINPUT; |
| 39 |
|
| 40 |
{-------------------------------------} |
| 41 |
{ hardware input structure definition } |
| 42 |
|
| 43 |
type |
| 44 |
HARDWAREINPUT = record |
| 45 |
Msg : DWORD; |
| 46 |
wParamLo : word; |
| 47 |
wParamHi : word; |
| 48 |
end; |
| 49 |
PHARDWAREINPUT = ^HARDWAREINPUT; |
| 50 |
|
| 51 |
{-------------------------------------} |
| 52 |
{ input structure } |
| 53 |
|
| 54 |
type |
| 55 |
TINPUT = record |
| 56 |
InputType : DWORD; |
| 57 |
|
| 58 |
case integer of |
| 59 |
1 : (mi : MOUSEINPUT); |
| 60 |
2 : (ki : KEYBDINPUT); |
| 61 |
3 : (hi : HARDWAREINPUT); |
| 62 |
end; |
| 63 |
PINPUT = ^TINPUT; |
| 64 |
|
| 65 |
{------------------------------------------------------------------------------} |
| 66 |
{ function definition } |
| 67 |
|
| 68 |
function SendInput(InputsCount : UINT; InputsPtr : PINPUT; Size : integer): UINT; stdcall; external user32; |