Venix Posted May 30, 2015 Share Posted May 30, 2015 (edited) To make a long story short I had started a thread before related to trying to call the GetGUIThreadInfo function in user32.dll. Thereafter I updated my AutoIt to realise how stupid I had been because it had already been coded in WinAPIsys.au3. This leads me to my next query, I am trying to compile this code in AutoIT version 3.3.6 but for one reason or another the DLL call seems to fail.Following is the error information.Z:\Window Moved.au3 (15) : ==> Subscript used with non-Array variable.: $display = WingetTitle($windowInformation[5]) $display = WingetTitle($windowInformation^ ERRORThe GetGUIThreadInfo function is simply copied from the WinAPIsys.au3 I just changed the name is all. The reason I can't just compile this on a modern version of AutoIT is that I work in a secure environment where I cant get anything digital in or out without an extreme amount of effort so I am stuck in the dark ages. I have virtual machine set up with the AutoIT 3.3.6 so I can test if any suggested solutions work :).Here is the code, any help is greatly appreciated.expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <SendMessage.au3> #include <WinAPI.au3> Opt("MustDeclareVars") Dim $hCurrentWindow, $threadProcessID, $pID, $windowInformation, $display While 1 $hCurrentWindow = WinGetHandle("[Active]") $pID = _WinAPI_GetCurrentProcessID() $threadProcessID = _WinApi_GetWindowThreadProcessId($hCurrentWindow, $pID) $windowInformation = GetGUIThreadInfo($threadProcessID) $display = WingetTitle($windowInformation[5]) If $display = "" Then $display = "No Active Move/Size Loop" ToolTip($display, 0, 0) Sleep(100) WEnd Func GetGUIThreadInfo($iThreadID) Local Const $tagGUITHREADINFO = 'dword Size;dword Flags;hwnd hWndActive;hwnd hWndFocus;hwnd hWndCapture;hwnd hWndMenuOwner;hwnd hWndMoveSize;hwnd hWndCaret;long rcCaret[4]' Local $tGTI = DllStructCreate($tagGUITHREADINFO) DllStructSetData($tGTI, 1, DllStructGetSize($tGTI)) Local $aRet = DllCall('user32.dll', 'bool', 'GetGUIThreadInfo', 'dword', $iThreadID, 'struct*', $tGTI) If @error Or Not $aRet[0] Then Return SetError(@error + 10, @extended, 0) Local $aResult[11] For $i = 0 To 6 $aResult[$i] = DllStructGetData($tGTI, $i + 2) Next For $i = 1 To 4 $aResult[6 + $i] = DllStructGetData($tGTI, 6 + 2, $i) Next For $i = 9 To 10 $aResult[$i] -= $aResult[$i - 2] Next Return $aResult EndFunc ;==>_WinAPI_GetGUIThreadInfo Edited May 30, 2015 by Venix Link to comment Share on other sites More sharing options...
Starstar Posted May 30, 2015 Share Posted May 30, 2015 Your code is working fine on my machine..... Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
Developers Jos Posted May 30, 2015 Developers Share Posted May 30, 2015 Not sure why you ask about Compilation, but you are not testing for success of GetGUIThreadInfo().When you look inside that Func you see there is an option it could return nothing and setting an error.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Venix Posted May 30, 2015 Author Share Posted May 30, 2015 Your code is working fine on my machine.....I can get it to work on an up to date version of AutoIT but not the outdated version I will need to try and compile it on which is version 3.3.6 I can post screenshots if that is of help to anyone? Link to comment Share on other sites More sharing options...
Starstar Posted May 30, 2015 Share Posted May 30, 2015 Try latest version AutoIt v3.3.12.0 Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
TheDcoder Posted May 30, 2015 Share Posted May 30, 2015 (edited) @Venix Why wont it compile ? What error do you get in the complication process? Edited May 30, 2015 by TheDcoder grammer EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Venix Posted May 30, 2015 Author Share Posted May 30, 2015 (edited) To reiterate what I had stated earlier. This will compile perfectly fine on a modern version of AutoIT. But given the circumstances of where I am going to be developing this program it will have to compile on version 3.3.6.Edit::Sorry for any trouble I realise this is a strange request. Edited May 30, 2015 by Venix Link to comment Share on other sites More sharing options...
Starstar Posted May 30, 2015 Share Posted May 30, 2015 Here is a screenshot that shows script compiled successfully. Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once." Link to comment Share on other sites More sharing options...
trancexx Posted May 30, 2015 Share Posted May 30, 2015 Older version of the language doesn't know about "struct*".If you want it to work there replace:...'struct*', $tGTI...with:...'ptr', DllStructGetPtr($tGTI) Venix 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Venix Posted May 30, 2015 Author Share Posted May 30, 2015 Older version of the language doesn't know about "struct*".If you want it to work there replace:...'struct*', $tGTI...with:...'ptr', DllStructGetPtr($tGTI) Thank you so much, It worked! 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