Dave's Brain

Browse - Programming Tips - How do I programmatically enable/disable the minimize and maximize buttons?

Date: 2010jun11
OS: Windows

Q.  How do I programmatically enable/disable the minimize and maximize buttons?

A.  

void DisableMinimizeButton(HWND hwnd) { SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_MINIMIZEBOX); } void EnableMinimizeButton(HWND hwnd) { SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_MINIMIZEBOX); } void DisableMaximizeButton(HWND hwnd) { SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_MAXIMIZEBOX); } void EnableMaximizeButton(HWND hwnd) { SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) | WS_MAXIMIZEBOX); }
From http://blogs.msdn.com/b/oldnewthing/

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.