Click and Mouse Up delayed events

- To test whether the click at 1:1 works or not. Mouse UP should be done before moving back
This commit is contained in:
Steve Jordi 2026-09-29 20:22:35 +02:00
commit f321a6ebea
3 changed files with 46 additions and 44 deletions

View file

@ -1,44 +1,44 @@
object frmMain: TfrmMain object frmMain: TfrmMain
Left = 0 Left = 0
Top = 0 Top = 0
Caption = 'Battery Monitor' Caption = 'Battery Monitor'
ClientHeight = 63 ClientHeight = 63
ClientWidth = 292 ClientWidth = 292
Color = clBtnFace Color = clBtnFace
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText Font.Color = clWindowText
Font.Height = -12 Font.Height = -12
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
OnCreate = FormCreate OnCreate = FormCreate
TextHeight = 15 TextHeight = 15
object lblStatus: TLabel object lblStatus: TLabel
Left = 181 Left = 181
Top = 13 Top = 13
Width = 100 Width = 100
Height = 15 Height = 15
AutoSize = False AutoSize = False
end end
object btnStart: TButton object btnStart: TButton
Left = 8 Left = 8
Top = 8 Top = 8
Width = 113 Width = 113
Height = 25 Height = 25
Caption = 'Start Monitor' Caption = 'Start Monitor'
TabOrder = 0 TabOrder = 0
OnClick = btnStartClick OnClick = btnStartClick
end end
object progressBar: TProgressBar object progressBar: TProgressBar
Left = 8 Left = 8
Top = 39 Top = 39
Width = 273 Width = 273
Height = 17 Height = 17
Enabled = False Enabled = False
Position = 87 Position = 87
MarqueeInterval = 0 MarqueeInterval = 0
BarColor = clLime BarColor = clLime
Step = 1 Step = 1
State = pbsPaused State = pbsPaused
TabOrder = 1 TabOrder = 1
end end
end end

View file

@ -97,6 +97,8 @@ begin
// Simulate mouse button press and release // Simulate mouse button press and release
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 1, 1, 0); mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 1, 1, 0);
Sleep(150); Sleep(150);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 1, 1, 0);
Sleep(50);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 1, 1, 0); mouse_event(MOUSEEVENTF_LEFTUP, 0, 1, 1, 0);
// Get back to position // Get back to position
mouse.CursorPos := currentPos ; mouse.CursorPos := currentPos ;