Thread: How to make a window unresizable?

  1. #1
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879

    Unhappy How to make a window unresizable?

    Hi, I was just wondering how I can make sure that the user can't resize a window that I make. It just sucks when I make a program and everything looks nice, but then looks awful if the user resizes the window.
    Last edited by Hunter2; 05-08-2002 at 08:40 PM.
    Just Google It. √

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

  2. #2
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    Windows created with WS_POPUPWINDOW or WS_OVERLAPPED can't be resized.

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    132
    OR you could always just have a large section of your drawing code (how the window is setup -- or how it looks) in your windows procedure function. Under WM_PAINT specifically. This way if the window is resized, or if the window is maximized, etc. its redrawn to fit the window.

    So instead of specifying specific co-ordinates for things in your window, change it so then you use other methods. To put text in the center of your window, use the following code:

    HDC hdc;

    switch(message)
    {
    case WM_PAINT:
    hdc = BeginPaint(hwnd, &ps);
    GetClientRect(hwnd, &rect);
    DrawText(hdc, TEXT("Here is text in the center of my window."), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
    EndPaint(hwnd, &ps);
    }


    So each time the window is redrawn (say after someone resizes it), the text will be redrawn in the center of the screen. Just an idea!

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