Resizing a Single window ?

This is a discussion on Resizing a Single window ? within the Windows Programming forums, part of the Platform Specific Boards category; Hello: I've created a Single window and would like to avoid resizing it each time it's displayed. What should I ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    37

    Resizing a Single window ?

    Hello:

    I've created a Single window and would like to avoid resizing it each time it's displayed.
    What should I do ?

    Any suggestion will be much appreciated.

    Thanks a lot.

    Best regards.

    Frandy

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,904
    Umm...I'm not sure what you mean by resizing it every time it's displayed. Do you mean every time you create and show it or just every time it's drawn?

    Either way...you're in complete control over the window's resizing if you're sizing it yourself....so if you don't want it to resize, just get rid of your code that's resizing it.

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Or if you are creating it the wrong size, create it the right size!
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    Registered User
    Join Date
    Aug 2004
    Posts
    37
    Of course, I can resize the window when it is displayed ! But I would like to 'freeze' the size that I need so that it remains unmodified each time I launch the project to avoid resizing it again. I hope I have been clearer now?

    Thanks again for any reply.

    Best regards.

    Frandy

  5. #5
    Registered User Xzyx987X's Avatar
    Join Date
    Sep 2003
    Posts
    107
    Not exactely... If you want the window to be the same size everytime you create it, then just use the same window size values with CreateWindowEx(). If you want to keep the user from resizing it, then don't use the resizable border style for the window.

  6. #6
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,904
    If you're the one setting the size, and the user can't resize the window...then...well, just set it to the same size every time.

    If you don't want the user to be able to resize, get rid of the resize style for your window.

    If you want to remember the last size of the window since the last launch, save it in the registry or in a file somewhere.

  7. #7
    Registered User
    Join Date
    Aug 2004
    Posts
    37
    Thanks for your replies.

    As I'm a beginner, I need more details.
    Please tell me how I can save the last size of the window in the registry or in a file.
    (The window is an SDI one created by means of the AppWizard, not from scratch)

    Best regards.

    Frandy

  8. #8
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    See the SrWin sample on this page.

    Windows C Snippets

  9. #9
    Registered User
    Join Date
    Aug 2004
    Posts
    37
    Tnx anonytmouse.
    I added SRWIN.C to my project but got a fatal error C1010 :'Unexpected end of file while looking for precompiled header direction'.
    What should I do ?

    Best regards.

    Frandy

  10. #10
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    I am still not clear what it is you are trying to do. Saving the size in the registry may be a sledge hammer cracking a very small nut.

    You create the window and it has the size you specified when you create it. That size is not correct, so you change the size. When you open the application again, it has returned to the original size.

    That is how I read the situation, and is, of course what should happen, it will open at the size YOU TELL IT to open at. So tell it to open at the correct size.

    Or am I still not seeing this right?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  11. #11
    Registered User
    Join Date
    Aug 2004
    Posts
    37
    You do see it right my dear but I don't know how and where I should TELL IT the size to open at. Is it in the Main Frame , in the OnCreate() or in the CMainFrame:PreCreateWindow() functions ?

    Anyhow, thanks for helping me.

    Best regards.

    Frandy

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 06-05-2009, 01:39 PM
  2. resizing OpenGL picture control in MFC window
    By stanlvw in forum Windows Programming
    Replies: 1
    Last Post: 03-19-2009, 04:21 PM
  3. Capture Window
    By lord mazdak in forum Windows Programming
    Replies: 0
    Last Post: 04-09-2007, 09:51 AM
  4. Fixed window size
    By The Brain in forum Windows Programming
    Replies: 5
    Last Post: 02-23-2006, 03:07 PM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 05:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21