Einzelnen Beitrag anzeigen

Benutzerbild von SirThornberry
SirThornberry
(Moderator)

Registriert seit: 23. Sep 2003
Ort: Bockwen
12.235 Beiträge
 
Delphi 2006 Professional
 
#5

Re: Eingaben eines andern Programms emulieren?

  Alt 11. Okt 2005, 16:59
@Kedario...: Die Lösung wurde doch schon gepostet (ohne Handle und hat damals auch bei GTA-ViceCity funktioniert)
Zitat:
Delphi-Quellcode:
Mouse_Event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
Mouse_Event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
@raffo: [OT]
folgendes ist ineffizient.
Zitat:
Delphi-Quellcode:
Label1.Caption := IntToStr(Mouse.CursorPos.X);
Label2.Caption := IntToStr(Mouse.CursorPos.Y);
Denn bei Mouse.CursorPos wird intern GetCursorPos aufgerufen und dann davon das X zurück gegeben.
Du rufst also in dem Fall 2 mal die ApiFunktion GetCursorPos auf (wenn auch indirekt).
Besser ist es dann so
Delphi-Quellcode:
var LPoint: TPoint;
begin
  GetCursorPos(LPoint);
  Label1.Caption := IntToStr(LPoint.X);
  Label2.Caption := IntToStr(LPoint.Y);
end;
oder so (um beim Mouseobject und der Objectorientierung zu bleiben
Delphi-Quellcode:
var LPoint: TPoint;
begin
  LPoint := Mouse.CursorPos;
  Label1.Caption := IntToStr(LPoint.X);
  Label2.Caption := IntToStr(LPoint.Y);
end;
[/OT]
Jens
Mit Source ist es wie mit Kunst - Hauptsache der Künstler versteht's
  Mit Zitat antworten Zitat