Thread: Stop window from being able to maximize

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    112

    Stop window from being able to maximize

    Hey, I have a program with a dialog and i want it not to be able to maximize. With the ms visual c++ resource editor I seleced it not to have the maximize button in the top right corner. However you can still click on the window on the taskbar and choose maximize. How can i stop this?

  2. #2
    Registered User
    Join Date
    Jun 2002
    Posts
    14
    I have a dialog and in the "Dialog Properties" under the "Styles" tab, I have "Title Bar", "System menu" & "Minimize box" checked and that disallows the dialog to be maximized even from the taskbar. I don't know if this is any help but I thought i'd say anyway.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    112
    Yah, i have the same things selected, however you can maximize it from the taskbar.

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    This is easy to do. When you create the window make sure that the third argument for the CreateWindow() doesn't OR in WS_MAXIMIZE, WS_OVERLAPPEDWINDOW, or WS_TILEDWINDOW. Now the window will be created without a maximize button (even on the task bar).

  5. #5
    Registered User
    Join Date
    Mar 2002
    Posts
    112
    I'm not using CreateWindow though. I'm making a dialog in visual c++ 6 and then calling it with DialogBox().

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Opps must read the other posts.


    If you create the dialog in VC then just deselect the 'maximise box' or 'system menu' under STYLES (2nd TAB) in the resource editor.

    else
    Get the dlg's style with GetWindowLong() and GWL_STYLE and '~' off the WS_MAXIMIZEBOX style.
    Then put the style back with SetWindowLong().
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  7. #7
    Registered User
    Join Date
    Mar 2002
    Posts
    112
    Yes, that exactly what I'm doing with VC.

    "and '~' off the WS_MAXIMIZEBOX style." How do you do this?

  8. #8
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Try this:

    -----
    ModifyStyle(WS_MAXIMIZEBOX, 0, 0)

    or

    GetParent()->ModifyStyle(WS_MAXIMIZEBOX, 0, 0)
    -----

    Kuphryn

  9. #9
    Registered User
    Join Date
    Mar 2002
    Posts
    112
    I'm not using mfc so those commands don't work.

  10. #10
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    DWORD foo=(DWORD) GetWindowLong(hwnd, GWL_STYLE);
    SetWindowLong(hwnd, GWL_STYLE, (LONG) (foo & (~WS_MAXIMIZE)));

    P.S. Replace hwnd with the handle of your window.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  2. creating a child window
    By rakan in forum Windows Programming
    Replies: 2
    Last Post: 01-23-2007, 03:22 PM
  3. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  4. maximize console window
    By detux in forum C Programming
    Replies: 1
    Last Post: 09-30-2006, 10:50 AM
  5. no maximize for the window
    By stallion in forum Windows Programming
    Replies: 3
    Last Post: 02-03-2003, 03:48 PM