views:

59

answers:

1

I have an MFC MDI Application and I am trying to implement Automation with it. I am trying to create a RemoveDocument. How is that done? OnCloseDocument is causing problems. Is there a "standard" for doing that?

A: 

You could just send a WM_CLOSE message to the Document's frame.

Edit: You could try sending it to the document's view instead. You can get all views that point to a given document by calling:

POSITION pos = pDoc->GetFirstViewPosition();
while( pos != NULL )
{
    CView* pView = GetNextView( pos );
}

I "think" that should do the trick ...

Goz
What if the document doesn't have a frame?? Tempalte->OpenDocumentFile(Path, FALSE); // <-- False means hidden
BabelFish