>> but it is still closing the whole application when I try
>> to exit the document frame.
Yes you will have to take care of that. When you use the close button in the top/right of the frame it should not close your dialog/application. If it does, you have other problems.
However the frames SystemMenu/Close and File/Exit menu items should close the entire applcation since they send the ID_APP_EXIT message.
So you need to resolve those issues. There is more than one way to do that. Here are some:
And a handler to your frame for ID_APP_EXIT and close the window.
CWnd::SendMessage( WS_CLOSE);
In CMainFrame::OnCreate modify the frame style and remove the system menu style
CWnd::ModifyStyle( WS_SYSTEM,0L);