Thread: How can I keep a window from being resized

  1. #1
    Registered User Dohojar's Avatar
    Join Date
    Feb 2002
    Posts
    115

    How can I keep a window from being resized

    I am trying to make a windows calculator without using a dialog box but I don't want the main window to change size. Can anyone help with this? I am sure it is probably something simple but I am at a loss.
    Dohojar Moajbuj
    Time is the greatest teacher, too bad it kills all its students

  2. #2
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361

    Re: How can I keep a window from being resized

    Originally posted by Dohojar
    I am trying to make a windows calculator without using a dialog box but I don't want the main window to change size. Can anyone help with this? I am sure it is probably something simple but I am at a loss.
    Don't pass WS_SIZEBOX as a style parameter to CreateWindow. If you're using WS_OVERLAPPEDWINDOW as the window style (as most do) then do: WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX

  3. #3
    Registered User Dohojar's Avatar
    Join Date
    Feb 2002
    Posts
    115
    Right on. Much thanks to ya. Been bugging me for a couple hours hehe
    Dohojar Moajbuj
    Time is the greatest teacher, too bad it kills all its students

  4. #4
    Registered User Dohojar's Avatar
    Join Date
    Feb 2002
    Posts
    115
    Right on. Much thanks to ya. Been bugging me for a couple hours hehe
    Dohojar Moajbuj
    Time is the greatest teacher, too bad it kills all its students

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    if you set the ScreenRect to the desired size and location when the app starts.

    Then catch and modify the WM_MOVING (to stop movement if needed) and WM_SIZE (to stop resize)

    Then just let the default msg processing do its stuff using your original params.

    Code:
    case  WM_MOVING:
    ((RECT*)lParam)->left=rScreenRect.left;
    ((RECT*)lParam)->right=rScreenRect.right;
    ((RECT*)lParam)->top=rScreenRect.top;
    ((RECT*)lParam)->bottom=rScreenRect.bottom;
    break;
    "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

  6. #6
    Registered User
    Join Date
    Apr 2003
    Posts
    1

    Question

    I am a beginner for windows designing. And I am also thinking of entering some data and getting back some calculating results from a window, something like your calculator. Could you post your code so than I can have an idea of how to begin my program?
    Thanks.

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. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 08:14 AM
  3. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  4. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  5. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM