Re: how to do a mouse click

From: Avatar Zondertau (avatarzondertau_at_hotmail.com)
Date: 01/05/04


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;



Relevant Pages

  • Re: how to do a mouse click
    ... MouseClick procedure via a button and when I click the ... Coordinate maps onto the ... > upper-left corner of the display surface, maps onto the ...
    (borland.public.delphi.nativeapi)
  • Re: Davyhulme canal query
    ... Davyhulme but I've not found any explanation of it on old maps. ... obvious junction with any other railway, ...
    (uk.rec.waterways)
  • Re: Yellowstone/Grand Teton
    ... Ilja Friedel wrote: ... maps this weekend to get an overview. ... You wrote a good explanation of the area. ... You should go over to South Mudd and check the map library. ...
    (rec.backcountry)