Jump to content

What is the best way to detect if a window is resizable?


Go to solution Solved by ioa747,

Recommended Posts

Posted

I'm trying to determine what is the best and most reliable way to determine if a window is resizable or not. 

I would think that I could check the GUIStyles to see what is applied. But there are many of them and sometimes it is a combination of several of them that makes a window resizable or not. I am not very good yet with BitAND and BitOR which is likely needed for that check on styles. I don't want to make a mistake and miss some combination of styles.

Aside from checking styles, is there any other way? Such as checking for availability of Minimize/Restore window button control?

This is needed for the GUIDarkTheme UDF. This check would be made after GUI creation and all controls, but right prior to GUISetState. So the GUI window will not be visible at the time of the check.

Thank you. :)

  • Solution
Posted

The most reliable way to determine if a window is resizable by the operating system
is to check if it has the WS_SIZEBOX (also known as WS_THICKFRAME) style.
 

Func _GUI_IsResizable($hWnd)
    Local $iStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE)
    ; Check if the WS_SIZEBOX (0x00040000) bit is set
    ; $WS_SIZEBOX and $WS_THICKFRAME are the same constant
    If BitAND($iStyle, $WS_SIZEBOX) Then
        Return True
    Else
        Return False
    EndIf
EndFunc   ;==>_GUI_IsResizable

 

I know that I know nothing

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
×
×
  • Create New...