![]() |
SetCursorPos(x,y) Function auf Handle bezogen?
Hallo, ich nutze die Function SetCrursorPos() um meine Maus auf dem Desktop zu einer bestimmten Podition zu bewegen.
Soweit ganz gut, da es funktioniert. Ist die Maus dann an der Position angekommen, möchte ich einen rechtklick ausführen lassen mittels PostMessage. Das aber nicht auf dem Desktop, sondern auf/ in einer fremden Anwendung. Ich habe auch das Anwendungshandle herausgefunden, aktiviere die Andwendung auch vor dem klick, damit überhaupt der rechtsklcik funktioniert. Nun habe ich aber das Problem, das der rechtsklick nicht an der Mausposition sondern an der position 0,0 in der fremden anwendung ausgeführt wird. Wie kann ich es anstellen damit genau an der gewünschten stelle der klick ausgeführt wird?
Delphi-Quellcode:
LG Marco
appactivate(Handle,1);
SetCursorPos(x,y); PostMessage(Handle,WM_RBUTTONDOWN,0,0); |
Re: SetCursorPos(x,y) Function auf Handle bezogen?
Vielleicht so
PostMessage(Handle,WM_RBUTTONDOWN,MK_RBUTTON,y shr 16 or x); WM_RBUTTONDOWN Notification The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse. A window receives this message through its WindowProc function. Syntax WM_RBUTTONDOWN WPARAM wParam LPARAM lParam; Parameters wParam Indicates whether various virtual keys are down. This parameter can be one or more of the following values. MK_CONTROL The CTRL key is down. MK_LBUTTON The left mouse button is down. MK_MBUTTON The middle mouse button is down. MK_RBUTTON The right mouse button is down. MK_SHIFT The SHIFT key is down. MK_XBUTTON1 Windows 2000/XP: The first X button is down. MK_XBUTTON2 Windows 2000/XP: The second X button is down. lParam The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area. Return Value |
Re: SetCursorPos(x,y) Function auf Handle bezogen?
Wenn der Mauszeiger schon an der richtigen Stelle steht, könnte man doch auch mit mouse_event() arbeiten, oder?
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:34 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz