Thread: I want to make my window non-maximiseable

  1. #1
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,403

    I want to make my window non-maximiseable

    How do I do that? I was thinking there would be an indentifier i put in place of: WS_OVERLAPPEDWINDOW, anyone know what it is?

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Start with WS_POPUP | WS_CAPTION and add the styles as you wish ...

    WS_MAXIMIZEBOX
    WS_MINIMIZEBOX
    WS_BORDER
    WS_SYSMENU

    ........yadda yadda......

  3. #3
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    When your window is being resized it is sent a message. You can capture this message in your Window Procedure and then resize your window back to the way you want. You would have to use WM_SIZE or WM_SIZING. There is a way to make the maximize button so it cannot be clicked on. Using CreateWindow() you can use these styles:
    WS_MAXIMIZE Creates a window that is initially maximized.
    WS_MAXIMIZEBOX Creates a window that has a Maximize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.
    WS_MINIMIZE Creates a window that is initially minimized. Same as the WS_ICONIC style.
    WS_MINIMIZEBOX Creates a window that has a Minimize button. Cannot be combined with the WS_EX_CONTEXTHELP style. The WS_SYSMENU style must also be specified.
    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  4. #4
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,403
    Thanks, ended up going with:
    WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    yeah that's pretty much what I use all the time, except that you don't need WS_CAPTION - I think it's included in WS_OVERLAPPED. If not, it's in one of the other ones
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #6
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Another way to stop your windows being resized is to catch the

    WM_MOVING msg and replace its params. Put them back to the original.

    I keep an array bout my apps windows. It holds HDC's, HWND's, ID's and rects.

    So I just put the screen rect back into the msg param.

    case WM_MOVING:
    ((RECT*)lParam)->left=rScreenRect.left;
    //ect
    break;

    and let the default winproc take care of it.
    "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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  2. my wndProc is out of scope
    By Raison in forum Windows Programming
    Replies: 35
    Last Post: 06-25-2004, 07:23 AM
  3. Make window in VB but make program in C/C++?
    By Boomba in forum Windows Programming
    Replies: 1
    Last Post: 06-23-2004, 12:29 AM
  4. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM