Jump to content

function syntax help


Recommended Posts

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
Link to comment
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.
Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...