Sign in to follow this  
Followers 0
dantay9

function syntax help

5 posts in this topic

#1 ·  Posted (edited)

I am trying to find out if the cursor is over a child window of my gui. I found ChildWindowFromPoint, but the script errors out and has to close unexpectedly. Am I using the syntax correctly? $GUI[0] is the parent window and $GUI[1] is the child. If you need the full code, I will post that too.

Here's the website: http://msdn.microsoft.com/en-us/library/ms632676(VS.85).aspx

You can also try RealChildWindowFromPoint

Func _GetHoverWindow()
       Local $Coords = DllStructCreate($tagPOINT)
       $Parent_Pos = WinGetPos($GUI[0])
       $Mouse_Pos = MouseGetPos()
       $Mouse_Pos[0] -= $Parent_Pos[0]
       $Mouse_Pos[1] -= $Parent_Pos[1]
       DllStructSetData($Coords, "X", $Mouse_Pos[0]); Populate Structure
       DllStructSetData($Coords, "Y", $Mouse_Pos[1]); Populate Structure
   
       Return DllCall("user32.dll", "hwnd", "ChildWindowFromPoint", "hwnd", WinGetHandle($GUI[0]), "ptr", DllStructGetPtr($Coords))
   EndFunc;==>_GetHoverWindow
Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites



Nobody knows? Is there another way to get the handle of the window that the cursor is over. It has to also get the handle of child guis, and not return the handle to the parent gui.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

Nobody knows? Is there another way to get the handle of the window that the cursor is over. It has to also get the handle of child guis, and not return the handle to the parent gui.

Searching didn't work then?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You are doing several things wrong (having both syntax and semantics errors). First is that DllCall returns array so it would be:

Local $aCall = DllCall("user32.dll", "hwnd", "ChildWindowFromPoint", ...
Return $aCall[0]

Another thind is that you are calling that function wrong. MSDN is not saying pointer anywhere. It should be like this:

Local $aCall = DllCall("user32.dll", "hwnd", "ChildWindowFromPoint", "hwnd", $hGui, "int", DllStructGetData($Coords, 1), "int", DllStructGetData($Coords, 2))

Third thing is that you don't need WinGetHandle() - see above.

edit:

actually you don't need to create that structure anyway, just supply ChildWindowFromPoint call with coordinates directly.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Thanks for the help. I am new to dll calls. I should be more careful to the exact wording of MSDN.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0