|
Потоки
#39953747
Ссылка:
Ссылка на сообщение:
Ссылка с названием темы:
|
|
|
|
И никаких потоков
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75.
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Button1: TButton;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
// X, Y, Interval
PosClick: TArray<Cardinal>;
// Count current position click, and length position count
PosCurrent, PosCount: Cardinal;
// Set click position
procedure SetPosClick(const Arr: TArray<Cardinal>);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.SetPosClick(const Arr: TArray<Cardinal>);
begin
PosCurrent := 0;
PosClick := Arr;
PosCount := High(PosClick);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
SetPosClick([]); // default
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SetPosClick([81, 51, 500, 190, 196, 1000, 63, 105, 1500]); // start
Timer1.Interval := 1;
Timer1.Enabled := true;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if PosCount < 3 then
ShowMessage('Align array of 3 = x,y,interval');
setcursorpos(PosClick[PosCurrent + 0], PosClick[PosCurrent + 1]);
mouse_event(mouseeventf_leftdown, 0, 0, 0, 0);
mouse_event(mouseeventf_leftup, 0, 0, 0, 0);
Timer1.Interval := PosClick[PosCurrent + 2];
inc(PosCurrent, 3);
if PosCurrent >= PosCount then
begin
Timer1.Enabled := false;
ShowMessage('Successful execution');
end;
end;
end.
|
|
|