开发者

C++ Windows remove maximize box

开发者 https://www.devze.com 2023-04-08 16:17 出处:网络
I\'m using these window styles when calling CreateWindow WS_OVERLAPPED | W开发者_开发问答S_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX

I'm using these window styles when calling CreateWindow

WS_OVERLAPPED | W开发者_开发问答S_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX

This disables the maximize box, but is there any way I can completely remove it?


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.


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);  
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号