this-is-me Posted March 2, 2014 Share Posted March 2, 2014 I am trying to get the location and size of the title bar buttons minimize, maximize and close. Before you offer to help by recommending getsystemmetrics, please understand that I don't want to use this function, since it may deliver incorrect information on Windows 7+, nor do I want to hard-code the values. According to MSDN, I should use WM_GETTITLEBARINFOEX to get this information. Since the $tagTITLEBARINFOEX structure is not defined anywhere, I have had to do most of the work of creating what I THINK this structure should look like in AutoIt. However, I am failing to get any values at all. Here is my current code: #include <WindowsConstants.au3> #include <StructureConstants.au3> #include <SendMessage.au3> $tagTITLEBARINFOEX = "int cbSize;" & $tagRECT & ";dword rgstate[6];dword rgrect[6]" $tTITLEBARINFOEX = DllStructCreate($tagTITLEBARINFOEX) DllStructSetData($tTITLEBARINFOEX, "cbSize", DllStructGetSize($tTITLEBARINFOEX)) $gui = GUICreate("hello", 500, 500, 10, 10) GUISetState(@SW_SHOW) Sleep(500) ;_SendMessage($gui, $WM_GETTITLEBARINFOEX, 0, $tTITLEBARINFOEX, 4, "wparam", "struct*") _SendMessage($gui, $WM_GETTITLEBARINFOEX, 0, DllStructGetPtr($tTITLEBARINFOEX), 4) If @error Then MsgBox(0,"","Errorrr") MsgBox(0,"",DllStructGetData($tTITLEBARINFOEX, "Left")) For $x = 0 To 5 MsgBox(0,"","rgstate[" & $x & "]...: " & DllStructGetData($tTITLEBARINFOEX, "rgstate", $x + 1)) Next I lifted a little of the information from the help file's _GUIScrollBars_GetScrollBarInfoEx example. My final intention is to get the rect values from rgrect[0-5]. However, I am completely lost. Please show me where my code is wrong. Who else would I be? Link to comment Share on other sites More sharing options...
JohnOne Posted March 2, 2014 Share Posted March 2, 2014 Is the last item in your structure supposed to be array of rect rather than array of dword? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
this-is-me Posted March 2, 2014 Author Share Posted March 2, 2014 Based on MSDN, yes, it is -supposed to- be, but I don't know how to declare it. Who else would I be? Link to comment Share on other sites More sharing options...
Solution LarsJ Posted March 2, 2014 Solution Share Posted March 2, 2014 That's easy: long rgrect[24] this-is-me 1 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
this-is-me Posted March 2, 2014 Author Share Posted March 2, 2014 (edited) Really? That seems simple, but how would I attempt to get the values for each rect? Do I just have to parse by groups of 4 numbers each time? edit:spelllllllling EDIT EDIT: Yes, that's exactly what I do. Thanks so much. Edited March 2, 2014 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
LarsJ Posted March 2, 2014 Share Posted March 2, 2014 Yes:x1 = DllStructGetData($tTITLEBARINFOEX, "rgrect", 1) xy = DllStructGetData($tTITLEBARINFOEX, "rgrect", 2) ... x2 = DllStructGetData($tTITLEBARINFOEX, "rgrect", 5) y2 = DllStructGetData($tTITLEBARINFOEX, "rgrect", 6) ... Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions 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