Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MFC,C++: Updating a view without calling its documents UpdateAllViews

Posted on 2007-12-05
4
Medium Priority
?
1,058 Views
Last Modified: 2013-12-14
I would like to update an MFC view when it is about to be displayed. I can only do this though a generic CView pointer, so the only functions of my own I can call are overloaded functions. I essentially want to call OnUpdate(), but cannot, as it is private. Only the framework may call OnUpdate(). That being the case, how can I update a single view, without calling my document's UpdateAllViews()?

Regards,
Sternocera
0
Comment
Question by:sternocera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 20411306
Two ways.
Use the UpdateAllViews and use lHint / pHint to stop views being pdated that you don't want updating.
Or in the OnUpdate call a public function eg. UpdateThisView, then for just updating one view call this directly pView->UpdateThisView();
0
 

Author Comment

by:sternocera
ID: 20411372
Andy,

I cannot know in advance exactly what sort of object my generic CView* will point to, which is why it is just a generic CView* , so I can't call anything that is not a CView member function. A bunch of views exist on the heap, and my generic CView* points to the currently viewed one.

I guess that just leaves the Hint method.

0
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 2000 total points
ID: 20411460
Nope - you can use a custom message eg WM_APP+123.  Pass it to the view in a SendMessage (or PostMessage) and it will be handled if the view knows how to respond to that message else it will end up in the great bit bucket in the bowels of windows.
0
 

Author Comment

by:sternocera
ID: 20411549
You're right - I should just send a custom message to have the view update,

very colourful analogy :-)

Thanks
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question