Dave's Brain

Browse - programming tips - win32 disable minimize maximize buttons

Date: 2010jun11
OS: Windows

Q.  How do I programatically 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/
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, 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.
Advertisements: