Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
Delphi 7 Enterprise
|
Re: SendInput - koordinaten x/y funtionnieren nicht
8. Aug 2008, 03:08
Was spricht gegen folgendes...
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
procedure Delay(ATime:Integer);
var Start : integer;
begin
Start := GetTickCount;
repeat
Application.ProcessMessages;
until abs(GetTickCount) - Start > ATime;
end;
procedure MouseClick(X, Y:cardinal);
var
Inp: TInput;
Point:TPoint;
begin
Inp.Itype := INPUT_MOUSE;
Inp.mi.dx := 0;
Inp.mi.dy := 0;
Inp.mi.time := 0;
Inp.mi.dwExtraInfo := 0;
Point:=Mouse.CursorPos;
repeat
SetCursorPos(X, Y);
Application.ProcessMessages;
until (Mouse.CursorPos.X = X) and (Mouse.CursorPos.Y = Y);
Inp.mi.dwFlags := MOUSEEVENTF_RIGHTDOWN;
SendInput(1, Inp, SizeOf(Inp));
Delay(20);
Inp.mi.dwFlags := MOUSEEVENTF_RIGHTUP;
SendInput(1, Inp, SizeOf(Inp));
repeat
SetCursorPos(Point.X, Point.Y);
Application.ProcessMessages;
until (Mouse.CursorPos.X = Point.X) and (Mouse.CursorPos.Y = Point.Y);
end;
begin
MouseClick(900, 350);
end;
|
|
Zitat
|