Sign in to follow this  
Followers 0
BackHomeAgain

Window attributes

10 posts in this topic

Is there some way to return window attributes that has information about frames/borders and if they can be re-sized?

For example, if I were to select the active window, can I find that information?

I want to determine if a given window is re-sizeable or not and which borders.

I know that MouseGetCursor can provide some information.

Share this post


Link to post
Share on other sites



You could try resizing with WinMove and then see if was successful with WinGetPos.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This may work. Get the size of the window with WinGetPos and subtract WinGetState WinGetClientSize. That may give you how thick the border is, if that is what you are looking for.

Edit: Sorry wrong function

Edited by blakel

Share this post


Link to post
Share on other sites

A true (>0) return means the window has the style set...

#Include <WinAPI.au3>
#Include <Constants.au3>
#Include <WindowsConstants.au3>
$hwnd_style = _WinAPI_GetWindowLong(WinGetHandle("[active]"), $GWL_STYLE)
ConsoleWrite(BitAND($hwnd_style,$WS_POPUP) & @crlf)
ConsoleWrite(BitAND($hwnd_style,$WS_SIZEBOX) & @crlf)
ConsoleWrite(BitAND($hwnd_style,$WS_SYSMENU) & @crlf)
ConsoleWrite(BitAND($hwnd_style,$DS_CONTEXTHELP) & @crlf)

$WS_SIZEBOX = "Creates a window that has a sizing border. Same as the WS_THICKFRAME style."

Share this post


Link to post
Share on other sites

A true (>0) return means the window has the style set...

#Include <WinAPI.au3>
#Include <Constants.au3>
#Include <WindowsConstants.au3>
$hwnd_style = _WinAPI_GetWindowLong(WinGetHandle("[active]"), $GWL_STYLE)
ConsoleWrite(BitAND($hwnd_style,$WS_POPUP) & @crlf)
ConsoleWrite(BitAND($hwnd_style,$WS_SIZEBOX) & @crlf)
ConsoleWrite(BitAND($hwnd_style,$WS_SYSMENU) & @crlf)
ConsoleWrite(BitAND($hwnd_style,$DS_CONTEXTHELP) & @crlf)

$WS_SIZEBOX = "Creates a window that has a sizing border. Same as the WS_THICKFRAME style."

Thanks for the information. It was very helpful.

Another question? How can a MsgBox be identified when it is the active window?

Share this post


Link to post
Share on other sites

I believe all Msgbox's have a class of #32770

Share this post


Link to post
Share on other sites

I believe all Msgbox's have a class of #32770

I thought of that, but other windows also use class #32770.

For example "Windows Task Manager".

There must be some unique attribute that separates MsgBox windows from others?

Share this post


Link to post
Share on other sites

Compare the styles with au3info.exe... maybe there's special style set unique to msgbox. Detect #32770 windows and check style with the function mentioned above.

Share this post


Link to post
Share on other sites

Compare the styles with au3info.exe... maybe there's special style set unique to msgbox. Detect #32770 windows and check style with the function mentioned above.

Window Extended style(EXStyle) 0x00010101 appears to be common to the MsgBox windows.

But, there is no Global Const that matches the value in WindowsConstants.au3

How did au3info.exe obtain this parameter?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

But, there is no Global Const that matches the value in WindowsConstants.au3

No need to know what it actually means :(...

#include <WinAPI.au3>
#include <Constants.au3>

HotKeySet("{ESC}", "_Exit")

While 1
    Sleep(25)
    $aHwnd = WinList("[CLASS:#32770;]", "")
    For $i = 1 To $aHwnd[0][0]
        If BitAND(WinGetState($aHwnd[$i][1]), 2) Then
            If _WinAPI_GetWindowLong($aHwnd[$i][1], $GWL_EXSTYLE) = 0x00010101 Then
                MsgBox(0, "", "MsgBox detected..." & @CRLF & WinGetTitle($aHwnd[$i][1]))
            EndIf
        EndIf
    Next
WEnd


Func _Exit()
    Exit
EndFunc   ;==>_Exit

Edit:

And actually they are there:

#include <WindowsConstants.au3>
ConsoleWrite(bitor($WS_EX_CONTROLPARENT,$WS_EX_DLGMODALFRAME,$WS_EX_WINDOWEDGE) & @crlf)
ConsoleWrite(0x00010101 & @crlf)

Edit2:

Closing SciTE the save message popped up as a msgbox alert... so maybe you'll have to add another layer by checking if only one button control is present in msgbox? Be as specific as possible :)...

Edited by KaFu

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  
Followers 0