Does anyone know where I can find an example of how to determine if the Maximize and/or Minimize buttons on a window are available and/or disabled?
The window will not be in the same process as my application. I have the hWnd and I have tried using GetMenuItemInfo, but I can't find any good samples for how to do this.
Thanks!
bool has_maximize_btn = (GetWindowLong(hWnd, GWL_STYLE) & WS_MAXIMIZEBOX) != 0;
bool has_minimize_btn = (GetWindowLong(hWnd, GWL_STYLE) & WS_MINIMIZEBOX) != 0;
The Win32 API provides the GetTitleBarInfo function which returns a TITLEBARINFO Structure:
typedef struct {
DWORD cbSize;
RECT rcTitleBar;
DWORD rgstate[CCHILDREN_TITLEBAR+1];
} TITLEBARINFO, *PTITLEBARINFO, *LPTITLEBARINFO;
So you could check the rgstate: Pointer to an array that receives a DWORD value for each element of the title bar. The following are the title bar elements represented by the array.
Index Title Bar Element
----- --------------------
0 The title bar itself
1 Reserved.
2 Minimize button
3 Maximize button <--------------
4 Help button
5 Close button
Each array element is a combination of one or more of the following values.
Value Meaning
----- -------------------------------------------
STATE_SYSTEM_FOCUSABLE The element can accept the focus.
STATE_SYSTEM_INVISIBLE The element is invisible.
STATE_SYSTEM_OFFSCREEN The element has no visible representation.
STATE_SYSTEM_UNAVAILABLE The element is unavailable.
STATE_SYSTEM_PRESSED The element is in the pressed state.rgstate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With