5

I'm using these window styles when calling CreateWindow
WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX
This disables the maximize box, but is there any way I can completely remove it?

crashmstr
  • 28,043
  • 9
  • 61
  • 79
Josh
  • 6,046
  • 11
  • 52
  • 83
  • 3
    I think it would be a bad idea to remove it because of the usability. The button immediately to the left of close is always maximize and to the left of that is always minimize. Changing things like that confuses people. – IronMensan Sep 27 '11 at 21:18
  • @HansPassant - Can you _PLEASE_ respond with a link to where I can read more about "Not Possible". It is really hard to believe that Microsoft would not provide a way to do this... (but I have looked, and so far cannot prove you wrong :) Thanks – ryyker Nov 21 '13 at 17:23
  • @HansPassant - Actually, I did a little more looking after concluding you were probably right (I find it difficult disagreeing with people having a 400K reputation on this site :) I tried the code ***[here](http://stackoverflow.com/a/20128564/645128)***, and it seems to work on Windows 7. – ryyker Nov 21 '13 at 18:26

2 Answers2

3

No easy way, but if you are going to draw the title bar yourself - in this case you can do it.

To give you an idea, this article Adding a 'Minimize to tray'-button to a Form's caption bar explains how to add a button. Removing standard button is about the same - customization of non-client area.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
1

This will remove the close, minimize and maximize buttons from a Windows 7 panel I realize this is very (very) late in coming, but posted it here as it may help someone else with same problem.

void ClearButtons(void)
{
    int index = WS_BORDER;
    unsigned int a = (unsigned int)((WS_BORDER | WS_CAPTION) & (~WS_ICONIC));

    LONG_PTR lPtr;
    HWND hWnd = GetActiveWindow();
    lPtr = GetWindowLongPtr(hWnd, index); 
    SetWindowLongPtr(hWnd, GWL_STYLE, a);  
}
ryyker
  • 22,849
  • 3
  • 43
  • 87