CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Location
    Antwerp, Belgium
    Posts
    136

    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 ?


  2. #2
    Join Date
    May 1999
    Posts
    116

    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.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured