Re: how to do a mouse click
From: Avatar Zondertau (avatarzondertau_at_hotmail.com)
Date: 01/05/04
- Next message: Brett Dever: "Re: Detect system tray Applications on WinXP?"
- Previous message: Rudy Ramsey: "Overloaded call in GetWindowThreadProcessID (D6)"
- In reply to: Geoff Elder: "Re: how to do a mouse click"
- Next in thread: Geoff Elder: "Re: how to do a mouse click"
- Reply: Geoff Elder: "Re: how to do a mouse click"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 5 Jan 2004 18:32:19 +0100
> Thanks.
>
> Your explanation makes sense but when I change the procedure to the
> following it doesn't work at all! (the items that it did work on no
> longer work)
>
> procedure MouseClick(x, y : Integer);
> begin
> mouse_event( MOUSEEVENTF_LEFTDOWN or MOUSEEVENTF_ABSOLUTE, x, y, 0, 0 );
> mouse_event( MOUSEEVENTF_LEFTUP or MOUSEEVENTF_ABSOLUTE, x, y, 0, 0 );
> end;
Sorry, i didn't read the entire sdk page for mouse_event. This may give info
why it doesn't work:
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.
This means it probably works if you change your code like this:
procedure MouseClick(x, y : Integer);
begin
x := x*65535 div Screen.Width;
y := y*65535 div Screen.Height;
mouse_event( MOUSEEVENTF_LEFTDOWN or MOUSEEVENTF_ABSOLUTE, x, y, 0, 0 );
mouse_event( MOUSEEVENTF_LEFTUP or MOUSEEVENTF_ABSOLUTE, x, y, 0, 0 );
end;
- Next message: Brett Dever: "Re: Detect system tray Applications on WinXP?"
- Previous message: Rudy Ramsey: "Overloaded call in GetWindowThreadProcessID (D6)"
- In reply to: Geoff Elder: "Re: how to do a mouse click"
- Next in thread: Geoff Elder: "Re: how to do a mouse click"
- Reply: Geoff Elder: "Re: how to do a mouse click"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|