View Issue Details

IDProjectCategoryView StatusLast Update
0035064FPCRTLpublic2019-09-14 15:12
Reporter440bxAssigned ToMarco van de Voort 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformWindowsOSWindowsOS Version2K and up
Product Version3.0.4Product Build 
Target VersionFixed in Version 
Summary0035064: the definition and associated constants and structures for user32's SendInput are missing.
Descriptionthe definition and associated constants and structures for user32's SendInput are missing.

The missing definitions are: (note: the names are very similar to those in MSDN but in most cases, not the same)


const
  INPUT_MOUSE = 0;
  INPUT_KEYBOARD = 1;
  INPUT_HARDWARE = 2;

{-------------------------------------}
{ mouse input structure definition }

type
  MOUSEINPUT = record
    dx : long;
    dy : long;
    MouseData : DWORD;
    Flags : DWORD;
    Time : DWORD;
    ExtraInfo : pointer;
  end;
  PMOUSEINPUT = ^MOUSEINPUT;

{-------------------------------------}
{ keyboard input structure definition }

type
  KEYBDINPUT = record
    Vk : word;
    Scan : word;
    Flags : DWORD;
    Time : DWORD;
    ExtraInfo : pointer;
  end;
  PKEYBDINPUT = ^KEYBDINPUT;


{-------------------------------------}
{ hardware input structure definition }

type
  HARDWAREINPUT = record
    Msg : DWORD;
    wParamLo : word;
    wParamHi : word;
  end;
  PHARDWAREINPUT = ^HARDWAREINPUT;

{-------------------------------------}
{ input structure }

type
  TINPUT = record
    InputType : DWORD;

    case integer of
      1 : (mi : MOUSEINPUT);
      2 : (ki : KEYBDINPUT);
      3 : (hi : HARDWAREINPUT);
  end;
  PINPUT = ^TINPUT;

{------------------------------------------------------------------------------}
{ function definition }

function SendInput(InputsCount : UINT; InputsPtr : PINPUT; Size : integer)
         : UINT; stdcall; external user32;

(Note: the above definitions have been tested for mouse input only in both 32bit and 64bit.)
Steps To ReproduceAttempt to compile a program that calls SendInput.
Additional InformationTested to work correctly when used to alter mouse coordinates. Not tested for keyboard nor hardware events.

TagsNo tags attached.
Fixed in Revision42994
FPCOldBugId
FPCTarget-
Attached Files

Activities

440bx

2019-02-12 04:49

reporter   ~0114046

Last edited: 2019-02-12 05:20

View 2 revisions

Forgot to include the flag definitions, here they are:

For mouse related events:

const
  XBUTTON1 = $1;
  XBUTTON2 = $2;

const
 MOUSEEVENTF_ABSOLUTE = $8000;
 MOUSEEVENTF_HWHEEL = $1000;
 MOUSEEVENTF_MOVE = $0001;
 MOUSEEVENTF_MOVE_NOCOALESCE = $2000;
 MOUSEEVENTF_LEFTDOWN = $0002;
 MOUSEEVENTF_LEFTUP = $0004;
 MOUSEEVENTF_RIGHTDOWN = $0008;
 MOUSEEVENTF_RIGHTUP = $0010;
 MOUSEEVENTF_MIDDLEDOWN = $0020;
 MOUSEEVENTF_MIDDLEUP = $0040;
 MOUSEEVENTF_VIRTUALDESK = $4000;
 MOUSEEVENTF_WHEEL = $0800;
 MOUSEEVENTF_XDOWN = $0080;
 MOUSEEVENTF_XUP = $0100;


for keyboard related events:

const
  KEYEVENTF_EXTENDEDKEY = $0001;
  KEYEVENTF_KEYUP = $0002;
  KEYEVENTF_SCANCODE = $0008;
  KEYEVENTF_UNICODE = $0004;

NOTE: straight cut and paste from windows documentation edited to use "$" instead of "0x"

Marco van de Voort

2019-09-14 15:12

manager   ~0118075

Committed.

Issue History

Date Modified Username Field Change
2019-02-12 04:35 440bx New Issue
2019-02-12 04:49 440bx Note Added: 0114046
2019-02-12 05:20 440bx Note Edited: 0114046 View Revisions
2019-09-14 15:12 Marco van de Voort Assigned To => Marco van de Voort
2019-09-14 15:12 Marco van de Voort Status new => resolved
2019-09-14 15:12 Marco van de Voort Resolution open => fixed
2019-09-14 15:12 Marco van de Voort Fixed in Revision => 42994
2019-09-14 15:12 Marco van de Voort FPCTarget => -
2019-09-14 15:12 Marco van de Voort Note Added: 0118075