Click here to Skip to main content
15,910,877 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Design Question Pin
Paul M Watt8-May-02 5:07
mentorPaul M Watt8-May-02 5:07 
GeneralSMTP server Pin
Edilson Vasconcelos de Melo Junior8-May-02 3:12
Edilson Vasconcelos de Melo Junior8-May-02 3:12 
GeneralRe: SMTP server Pin
Nish Nishant8-May-02 3:44
sitebuilderNish Nishant8-May-02 3:44 
GeneralRe: SMTP server Pin
Edilson Vasconcelos de Melo Junior8-May-02 5:38
Edilson Vasconcelos de Melo Junior8-May-02 5:38 
GeneralRe: SMTP server Pin
David Cunningham8-May-02 4:11
cofounderDavid Cunningham8-May-02 4:11 
GeneralRe: SMTP server Pin
Edilson Vasconcelos de Melo Junior8-May-02 5:43
Edilson Vasconcelos de Melo Junior8-May-02 5:43 
QuestionSingle View & Multiple Document Problem? Pin
8-May-02 2:02
suss8-May-02 2:02 
AnswerRe: Single View & Multiple Document Problem? Pin
Jonathan Craig8-May-02 3:32
Jonathan Craig8-May-02 3:32 
If you notice the UpdateAllViews method is a member of the CDocument class. It will only send the update message to views attached to that instance of the CDocument object. If you want a more global update method, you can do it through the app like this:
void CMyApp::UpdateEverybody()
{
    POSITION posTemplate;
    POSITION posDocument;
 
    //Look through the list of templates.
    posTemplate = GetFirstDocTemplatePosition();
    while(posTemplate)
    {
        CDocTemplate* pTemplate = GetNextDocTemplate(posTemplate);
        if(pTemplate)
        {
            //Look through the list of docs.
            posDocument = pTemplate->GetFirstDocPosition();
            while(posDocument)
            {
                CDocument *pDoc = theApp.pDefectDocTemplate->GetNextDoc(posDocument);
                if(pDoc)
                    pDoc->UpdateAllViews(NULL);
            }
        }
    }
}
In your code you make the call like this:
//In your code.
...
    //Update everybody.
    theApp.UpdateEverybody();
...
I also like the declare the theApp object as extern so most of my code can see it. Add this one line to your apps header:
class CMyApp : public CWinApp
{
    ...
};
 
//Add this.
extern CMyApp theApp;
There may be other and better ways to do this, maybe someone else will respond with other answers. This method has worked well for me in the past.

Hope this helps...Smile | :)

Jonathan Craig
www.mcw-tech.com
GeneralRe: Single View & Multiple Document Problem? Pin
8-May-02 17:48
suss8-May-02 17:48 
GeneralRe: Single View & Multiple Document Problem? Pin
Jonathan Craig9-May-02 5:07
Jonathan Craig9-May-02 5:07 
GeneralDrag and Drop, (getting target info) Pin
8-May-02 1:22
suss8-May-02 1:22 
GeneralCommunicating to devices via RS232 to RS485 converter Pin
Agnihothra8-May-02 1:02
Agnihothra8-May-02 1:02 
GeneralRe: Communicating to devices via RS232 to RS485 converter Pin
Tim Smith8-May-02 2:42
Tim Smith8-May-02 2:42 
QuestionWhy Pointers? Pin
a.a8-May-02 0:58
a.a8-May-02 0:58 
AnswerRe: Why Pointers? Pin
8-May-02 1:25
suss8-May-02 1:25 
GeneralRe: Why Pointers? Pin
redeemer8-May-02 12:42
redeemer8-May-02 12:42 
GeneralRe: Why Pointers? Pin
8-May-02 22:36
suss8-May-02 22:36 
AnswerRe: Why Pointers? Pin
Philip Patrick8-May-02 1:34
professionalPhilip Patrick8-May-02 1:34 
AnswerRe: Why Pointers? Pin
Andrew Peace8-May-02 1:56
Andrew Peace8-May-02 1:56 
AnswerRe: Why Pointers? Pin
LittleYellowBird8-May-02 2:17
LittleYellowBird8-May-02 2:17 
AnswerRe: Why Pointers? Pin
Joaquín M López Muñoz8-May-02 3:07
Joaquín M López Muñoz8-May-02 3:07 
GeneralRe: Why Pointers? Pin
a.a8-May-02 3:27
a.a8-May-02 3:27 
AnswerRe: Why Pointers? Pin
Nish Nishant8-May-02 3:57
sitebuilderNish Nishant8-May-02 3:57 
AnswerRe: Why Pointers? [Just memory! ] Pin
Maxwell Chen8-May-02 8:45
Maxwell Chen8-May-02 8:45 
QuestionEasiest way to display colored text in a textbox? Pin
generic_user_id8-May-02 0:45
generic_user_id8-May-02 0:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.