Helomotorola Posted September 13, 2007 Share Posted September 13, 2007 (edited) While 1 Sleep (1) $hwnd = WindowFromPoint(Point()) ToolTip($hwnd, 0, 0) WEnd Func Point() $pos = MouseGetPos() $str = "int var1;ubyte var2;uint var3;char var4[128]" $a = DllStructCreate($str) if @error Then MsgBox(0,"","Error in DllStructCreate " & @error); exit endif DllStructSetData($a,"X",$pos[0]) DllStructSetData($a,"Y",$pos[1]) EndFunc Func WindowFromPoint($tPoint) Local $iX, $iY, $aResult $iX = DllStructGetData($tPoint, "X") $iY = DllStructGetData($tPoint, "Y") $aResult = DllCall("User32.dll", "hwnd", "WindowFromPoint", "int", $iX, "int", $iY) Return $aResult[0] EndFunc Thank Edited September 13, 2007 by Helomotorola Link to comment Share on other sites More sharing options...
DjDeep00 Posted September 13, 2007 Share Posted September 13, 2007 I am very unclear about what your question is? Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 13, 2007 Share Posted September 13, 2007 We've been here before... Why are you putting the X/Y values in a struct, when you don't use it for the call to WindowFromPoint?Drop the struct if you aren't going to use it:HotKeySet("{ESC}", "_Quit") While 1 Sleep(100) ToolTip("") $hwnd = WindowFromPoint(MouseGetPos()) ToolTip($hwnd) WEnd Func WindowFromPoint($aPoint) $aResult = DllCall("User32.dll", "hwnd", "WindowFromPoint", "int", $aPoint[0], "int", $aPoint[1]) Return $aResult[0] EndFunc ;==>WindowFromPoint Func _Quit() Exit EndFunc ;==>_Quit Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Helomotorola Posted September 13, 2007 Author Share Posted September 13, 2007 Hix, i want use "DllStructSetData". Please help me Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 13, 2007 Moderators Share Posted September 13, 2007 Hix, i want use "DllStructSetData". Please help meWhat are you even doing with the struct (from your example) that you need one? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 13, 2007 Share Posted September 13, 2007 Hix, i want use "DllStructSetData". Please help me OK, if it's just an exercise, this works: HotKeySet("{ESC}", "_Quit") Global $Struct = DllStructCreate("int x;int y") While 1 Sleep(100) ToolTip("") Pos() $hwnd = WindowFromPoint() ToolTip($hwnd) WEnd Func Pos() DllStructSetData($Struct, "x", MouseGetPos(0)) DllStructSetData($Struct, "y", MouseGetPos(1)) EndFunc ;==>Pos Func WindowFromPoint() Local $x = DllStructGetData($Struct, "X") Local $y = DllStructGetData($Struct, "Y") Local $aResult = DllCall("User32.dll", "hwnd", "WindowFromPoint", "int", $x, "int", $y) Return $aResult[0] EndFunc ;==>WindowFromPoint Func _Quit() Exit EndFunc ;==>_Quit In your original struct (copied from an unrelated help file script I suspect), you variables were named var1, var2, etc., which is why they don't work when you call them by "X" and "Y". Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now