Mouse Click (1.1) to trigger action against sleep

Mouse movements seem to not be enough to appear active.
This commit is contained in:
Steve Jordi 2026-09-29 16:35:18 +02:00
commit 5e0537cb20

View file

@ -17,8 +17,11 @@ type
private
{ Private declarations }
FMyTask : ITask ;
currentPos : TPoint ;
counter : Integer ;
procedure startTask ;
procedure stopTask ;
public
{ Public declarations }
end;
@ -39,6 +42,8 @@ procedure TfrmMain.FormCreate(Sender: TObject);
begin
direction := False ;
runIt := False ;
currentPos := Point( mouse.CursorPos.X , mouse.CursorPos.Y ) ;
counter := 0 ;
end;
@ -82,6 +87,21 @@ begin
procedure
begin
direction := Not direction ;
counter := counter + 1 ;
if counter >= 60 then
begin
counter := 0 ;
// Move cursor to specific screen coordinates
currentPos := Point( mouse.CursorPos.X , mouse.CursorPos.Y ) ;
mouse.CursorPos := Point( 1, 1 ) ;
// Simulate mouse button press and release
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 1, 1, 0);
Sleep(150);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 1, 1, 0);
// Get back to position
mouse.CursorPos := currentPos ;
end;
if direction then
mouse.CursorPos := Point( mouse.CursorPos.X + 2, mouse.CursorPos.Y + 2 )
else