Called by the framework before a frame window displaying the document is closed.

virtual BOOL CanCloseFrame( 
   CFrameWnd* pFrame  


  • pFrame
    Points to the frame window of a view attached to the document.

Return Value

Nonzero if it is safe to close the frame window; otherwise 0.


The default implementation checks if there are other frame windows displaying the document. If the specified frame window is the last one that displays the document, the function prompts the user to save the document if it has been modified. Override this function if you want to perform special processing when a frame window is closed. This is an advanced overridable.


Header: afxwin.h

See Also


CDocument Class

Hierarchy Chart


Other Resources

CDocument Members