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/