Multithreading and UpdateAllViews in CDocument
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 ?
Re: Multithreading and UpdateAllViews in CDocument
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.