Get windows at x,y ; simulate mouse

Just starting out? Need help? Post your questions and find answers here.
willib
User
User
Posts: 39
Joined: Mon Sep 15, 2003 7:04 pm
Location: Bielefeld

Get windows at x,y ; simulate mouse

Post 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
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Get windows at x,y ; simulate mouse

Post 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)
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

WindowFromPoint_()
and
ChildWindowFromPoint_()
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post 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"
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

oh freedimension, you were quicker :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

blueznl wrote:oh freedimension, you were quicker :-)
I always am. I'm no lazy guy like ... you know who I mean :D
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

oh *him*

8)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
willib
User
User
Posts: 39
Joined: Mon Sep 15, 2003 7:04 pm
Location: Bielefeld

Post by willib »

Thanks a lot, I will try ....
willib
User
User
Posts: 39
Joined: Mon Sep 15, 2003 7:04 pm
Location: Bielefeld

Post 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 ? ;-)
dontmailme
Enthusiast
Enthusiast
Posts: 537
Joined: Wed Oct 29, 2003 10:35 am

Post 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;

:)
Paid up PB User !
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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
quidquid Latine dictum sit altum videtur
Post Reply