Page 1 of 1

Get windows at x,y ; simulate mouse

Posted: Sun Apr 04, 2004 3:45 pm
by willib
HI ALL

I need the handle of a window a a specific point f.e. at 30,40 or somewhere else on the screen ,but i do not find a API call for this.
Does someone know a funktion ? ( WINDOWS )

I want to simulate the following think:
Go with the mouse to one point ; press mousekey one ; go to another point ; free the mousekey.

Any idea would be appreciated.

Best regards Willi

Re: Get windows at x,y ; simulate mouse

Posted: Mon Apr 05, 2004 3:23 am
by PB
> Go with the mouse to one point ;
> press mousekey one ;
> go to another point ;
> free the mousekey.

Code: Select all

SetCursorPos_(pos1_x,pos1_y)
mouse_event_(#MOUSEEVENTF_LEFTDOWN,0,0,0,0)
SetCursorPos_(pos2_x,pos2_y)
mouse_event_(#MOUSEEVENTF_LEFTUP,0,0,0,0)

Posted: Mon Apr 05, 2004 8:08 am
by freedimension
WindowFromPoint_()
and
ChildWindowFromPoint_()

Posted: Mon Apr 05, 2004 8:13 am
by blueznl
not sure but aren't there windowfrompoint_() and similar command in the winapi?... checking... fromw win32.hlp:

"the WindowFromPoint function retrieves the handle of the window that contains the specified point"

Posted: Mon Apr 05, 2004 8:13 am
by blueznl
oh freedimension, you were quicker :-)

Posted: Mon Apr 05, 2004 8:24 am
by freedimension
blueznl wrote:oh freedimension, you were quicker :-)
I always am. I'm no lazy guy like ... you know who I mean :D

Posted: Mon Apr 05, 2004 8:29 am
by blueznl
oh *him*

8)

Posted: Mon Apr 05, 2004 4:02 pm
by willib
Thanks a lot, I will try ....

Posted: Mon Apr 05, 2004 6:35 pm
by willib
Hi again

My api dokumentation tells me to give the WindowFromPoint_ funktion an strukture of a point

Code: Select all

The WindowFromPoint function retrieves the handle of the window that contains the specified point. 

HWND WindowFromPoint(

    POINT Point 	// structure with point
   );
but when i try to do this in Purebasic he tells me incorrect number of parameters.
I gave him 2 variable x and y and it runs , is my API dok corrupt ? ;-)

Posted: Mon Apr 05, 2004 6:40 pm
by dontmailme
willib wrote:Hi again

My api dokumentation tells me to give the WindowFromPoint_ funktion an strukture of a point

Code: Select all

The WindowFromPoint function retrieves the handle of the window that contains the specified point. 

HWND WindowFromPoint(

    POINT Point 	// structure with point
   );
but when i try to do this in Purebasic he tells me incorrect number of parameters.
I gave him 2 variable x and y and it runs , is my API dok corrupt ? ;-)
Not corrupt........ read you post again..... // structure with point.....

It's a structure..... and this is it....

typedef struct tagPOINT {
LONG x;
LONG y;
} POINT, *PPOINT;

:)

Posted: Mon Apr 05, 2004 7:07 pm
by freak
The API call requires the whole structure on the stack, not just it's adress.
That doesn't work in PB, so you have to have x and y as seperate parameters.
It is both the same for the api function.. it won't notice :)

Timo