Einzelnen Beitrag anzeigen

The Riddler
(Gast)

n/a Beiträge
 
#3

Re: Klick auf aktives Fenster landet woanders

  Alt 18. Okt 2008, 23:58
Hat sich erledigt.

Delphi-Quellcode:
procedure TForm1.Button4Click(Sender: TObject);
var
  wnd: THandle;
  Rec: TRect;
begin
  wnd := GetForegroundWindow;
  GetWindowRect(wnd, Rec);
  showmessage(inttostr(rec.Left+3) + ' x ' + inttostr(rec.top+3));
  SetCursorPos(rec.Left+30, rec.top+30);

  mouse_event(MOUSEEVENTF_LEFTDOWN,rec.Left+3, rec.top+3,0,0);
  mouse_event(MOUSEEVENTF_LEFTUP,rec.Left+3, rec.top+3,0,0);
end;
Zitat:
Da ist das Problem: If MOUSEEVENTF_ABSOLUTE value is specified, dx and dy contain normalized absolute coordinates between 0 and 65,535. The event procedure maps these coordinates onto the display surface. Coordinate (0,0) maps onto the upper-left corner of the display surface, (65535,65535) maps onto the lower-right corner.
  Mit Zitat antworten Zitat