MFC - How to send messages between 2 different Views

548 views Asked by At

I have 2 CView-derived classes, CThumbView and CMainView. The CThumbView class displays thumbnails of images and the CMainView class controls the View that displays the original image.

I want to display the first thumbnail and its original when my application starts up. I tried using OnInitialUpdate, but that is not the ideal way as it bothered the other functionalities that was handling the main view.

How can I do this by sending a user-defined message between the 2 views?

1

There are 1 answers

0
Gautam Jain On

Since you are using the Document View Architecture you need to take advantage of the CDocument::UpdateAllViews function of the document from your view in order to update rest of the views. This function will call OnUpdate of each view.

The data is held by the document. Views access the data & update themselves accordingly.