Click to See Complete Forum and Search --> : Multithreading and UpdateAllViews in CDocument


Franky Braem
May 5th, 1999, 08:13 AM
Hi,

I have started a thread in my documentclass to watch modifications of files that I manage in the document. When the thread sees a change, my documentmember-function OnFileChange is called. In that function I want to display the changes in my views. And that's the problem : UpdateAllViews can't be called in the threadprocess.

Is there someone who has a good solution for this ?

BrianOG
May 5th, 1999, 08:39 AM
The thread can send a message to the mainframe, which can get the doc to update all views.

In thread:
AfxGetMainWnd()->SendMessage(WM_GETDOCTOUPDATEVIEWS);



In Mainframe:
CMainFrame::OngetDocToUpdateViews()
{
GetActiveDocument()->UpdateAllViews();
}



You will have to define WM_GETDOCTOUPDATEVIEWS your self and manually add is to the message map.