Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4594306
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:48:33+00:00 2026-05-21T22:48:33+00:00

I have an MFC app, it got the Document/View architecture, but set to use

  • 0

I have an MFC app, it got the Document/View architecture, but set to use only a single view. So far so good.

I was loading a file in the document and thought that the best way to notify the view of the new data was to call UpdateAllViews() when the file finished loading. It works good; I can transfer the data from the document to the view via the OnUpdate() function in the view.

However, right after OnUpdate() is called OnSize() is also called. This wouldn’t be a problem if it wasn’t for the fact that it’s called with the size the window had when it was created. So if I start the program, resize the window and then open a file, the window will pop back to the size it had initially! If I maximize the window and then call UpdateAllViews() it will resize while still thinking it’s maximized so I have to restore it before I can even change the size of it again. This is highly annoying and I wonder if there is any way to go around it? Maybe I can’t even use UpdateAllViews() in this way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T22:48:34+00:00Added an answer on May 21, 2026 at 10:48 pm

    Ok so it turned out that this wasn’t due to the UpdateAllViews(). This actually happens whenever you open a document in MFC. A lot of stuff happens when you do this and among that apparently a resize-command is sent.

    This resize command will resize the view to the size of its “document” (not to be confused with the document in the document/view architecture). In my case (as I was basing my view on a CFormView), the document size was the size of the form.

    The form is not by default resized when you resize the window, which I guess is kind of logical, so whenever a “refresh” of the view happens it will size itself to fit its form.

    I solved this by calling SetScaleToFitSize() in the OnSize() function of my view, which results in a resize of not only the view but the form itself whenever the view is resized. As the form now always has the same size as the view, the size update that is sent whenever a file is opened has no effect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C++/MFC app on windows - dynamically linked it's only 60kb static
I have an MFC app which I have been working on for a few
I have an MFC sdi app that uses a splitter window to contain a
I have an MFC legacy app that I help to maintain. I'm not quite
We have a monolithic MFC GUI app that is nearing the end of it's
We have multiple MFC apps, which use CMutex( false, blah ), where blah allows
I have a C++/MFC application I need to restructure. The app used to process
I have an MFC application compiled with /clr and I'm trying to implement a
I have CLI/MFC application and I would like to begin to learn how to
I have a MFC dialog with 32 CComboBoxes on it that all have the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.