Andreik Posted November 7, 2011 Share Posted November 7, 2011 I don't see anything wrong in this code but the result is not what I expect. I am doing something wrong? #include <WinAPI.au3> Global $GUI = GUICreate("Example") GUISetState(@SW_SHOW,$GUI) While True If GUIGetMsg() = -3 Then Exit Check() Sleep(10) WEnd Func Check() Local $rect = _WinAPI_GetWindowRect($GUI) Local $point = DllStructCreate($tagPOINT) DllStructSetData($point,"X",MouseGetPos(0)) DllStructSetData($point,"Y",MouseGetPos(1)) $result = _WinAPI_PtInRect($rect,$point) TrayTip("","Mouse over GUI: " & $result,1) EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
trancexx Posted November 7, 2011 Share Posted November 7, 2011 (edited) You are not doing anything wrong. This is bug on our side. This is one of the reasons "struct" data type is introduced to the language. Will be fixed. Use this in the meantime (and one of latest betas): Func _WinAPI_PtInRect(ByRef $tRect, ByRef $tPoint) Local $aResult = DllCall("user32.dll", "bool", "PtInRect", "struct*", $tRect, "struct", $tPoint) If @error Then Return SetError(1, 0, False) Return $aResult[0] EndFunc Edited November 7, 2011 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Andreik Posted November 7, 2011 Author Share Posted November 7, 2011 (edited) Thank you! Actually I`m not interested in use of this code but I start writing an AutoIt tutorial in romanian language and I tried to make an example using this function. EDIT: btw I never noticed "struct" as data type for DllCall, I got @error=1 if I change this with "ptr" I don't get any error but the result is all time false. Edited November 7, 2011 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted November 7, 2011 Share Posted November 7, 2011 EDIT:btw I never noticed "struct" as data type for DllCall, I got @error=1 if I change this with "ptr" I don't get any error but the result is all time false.She told you to use the beta for a reason. "struct" type was added in 3.3.7.20 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Ascend4nt Posted November 7, 2011 Share Posted November 7, 2011 You could also modify trancexx's function above to this for the current production version (added 1 more underscore to name): Func __WinAPI_PtInRect(ByRef $tRect, ByRef $tPoint) Local $iPt = DllStructGetData(DllStructCreate('uint64',DllStructGetPtr($tPoint)),1) Local $aResult = DllCall("user32.dll", "bool", "PtInRect", "ptr", DllStructGetPtr($tRect), "uint64", $iPt) If @error Then Return SetError(1, 0, False) Return $aResult[0] EndFunc My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
Andreik Posted November 7, 2011 Author Share Posted November 7, 2011 Sorry I have just 3.3.7.19, I go for update now. When the words fail... music speaks. 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