Jump to content
Sign in to follow this  
this-is-me

Frustrated trying to use WM_GETTITLEBARINFOEX

Recommended Posts

this-is-me

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?

Share this post


Link to post
Share on other sites
this-is-me

Based on MSDN, yes, it is -supposed to- be, but I don't know how to declare it.


Who else would I be?

Share this post


Link to post
Share on other sites
LarsJ
this-is-me

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?

Share this post


Link to post
Share on other sites
LarsJ

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.