共用方式為


CDocument::UpdateAllViews

Call this function after the document has been modified.

void UpdateAllViews(
   CView* pSender,
   LPARAM lHint = 0L,
   CObject* pHint = NULL 
);

Parameters

  • pSender
    Points to the view that modified the document, or NULL if all views are to be updated.

  • lHint
    Contains information about the modification.

  • pHint
    Points to an object storing information about the modification.

Remarks

You should call this function after you call the SetModifiedFlag member function. This function informs each view attached to the document, except for the view specified by pSender, that the document has been modified. You typically call this function from your view class after the user has changed the document through a view.

This function calls the CView::OnUpdate member function for each of the document's views except the sending view, passing pHint and lHint. Use these parameters to pass information to the views about the modifications made to the document. You can encode information using lHint and/or you can define a CObject-derived class to store information about the modifications and pass an object of that class using pHint. Override the CView::OnUpdate member function in your CView-derived class to optimize the updating of the view's display based on the information passed.

Example

void CExampleDoc::OnUpdateAllViews()
{
   UpdateAllViews(NULL);
}

Requirements

Header: afxwin.h

See Also

Reference

CDocument Class

Hierarchy Chart

CDocument::SetModifiedFlag

CDocument::GetFirstViewPosition

CDocument::GetNextView

CView::OnUpdate

Other Resources

CDocument Members