Jump to content

Frustrated trying to use WM_GETTITLEBARINFOEX


Go to solution Solved by LarsJ,

Recommended Posts

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

  • Solution

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 by this-is-me
Who else would I be?
Link to comment
Share on other sites

Yes:

x1 = DllStructGetData($tTITLEBARINFOEX, "rgrect", 1)
xy = DllStructGetData($tTITLEBARINFOEX, "rgrect", 2)
...
x2 = DllStructGetData($tTITLEBARINFOEX, "rgrect", 5)
y2 = DllStructGetData($tTITLEBARINFOEX, "rgrect", 6)
...
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...