Autor Beitrag
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Di 24.10.06 16:42 
Hallo!

Ich also schon wieder mit nem Problem :)

Ich möchte/muss nen Mausklick simulieren. Ich weiß, das Problem ist alt, aber ich hab noch n Problem dazu: das Fenster, was ich klicken möchte, ist entweder minimiert, im Hintergrund oder ganz versteckt. Jedenfalls nicht im Vordergrund, daher kann ich nicht mit SetCursorPos() und mouse_event abrbeiten.

Ich hab mich jetzt mit Sendmessage versucht, aber das geht so gut wie nie:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure ClickWinAt(Wnd:Hwnd; X,Y:integer);
var v:integer;
begin
  v:= MakeLParam(X,Y);

  SendMessage(wnd,WM_LBUTTONDOWN,MK_LBUTTON,v);
  Sleep(10); //kurz warten, spielt aber keine Rolle?
  SendMessage(wnd,WM_LBUTTONUP,MK_LBUTTON,v);
end;

Die Prozedur soll einen Linksklick auf das Fenster wnd an Position X,Y relativ zur linken oberen Ecke des Fensters machen. Tut sie aber nicht. Interessant ist: manchmal gehts, aber ich weiß nicht unter welchen Umständen.

An falschen Koordinaten kann es nicht liegen, ich hab mir vorhin als Test mal ein DC geben lassen und nen Punkt gemalt, das passt alles.

Danke schonmal,
Sebastian

Edit: interessant. Man kann einen Klick auf eine OpenGL-Zeichenfläche simulieren, der kommt auch richtig an. In ein dann geöffnetes WebBrowser-Fenster kann man nicht klicken :(

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Mo 30.10.06 13:39 
Du könntest dir auch das Handle des Fensters nehmen und es in den Vordergrund holen.

MfG
Martok Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: Mo 30.10.06 15:44 
Geht nicht.

Ist aber auch egal, da ich die durch den Klick ausgelösten Aktionen jetzt komplett selbst durchführe. Musste zwar das halbe Programm nachprogrammieren, aber dafür gehts jetzt.

-Closed-

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."