AfxGetMainWnd()->SendMessage(WM_COMMAND, ID_FILE_SAVE, 0);
* How can I reload the file from MFC?
I've tried using ID_FILE_NEW, ID_FILE_OPEN, & ID_FILE_MRU_FILE1 (the file
menu's recent history list) with the code above with no luck. I traced it
through the debugger hoping to find the File | Open routine and I got into
some assembler code...
I noticed when trying to reload the SDI doc manually that clicking on open
and selecting the file from the open dialog does NOT reload the file. I have
to manually click on New then Open then select the file for it to work. Even
when the Modified flag is set.
I created an OnFileOpen event function with the ClassWizard, hoping to call
that, but the default behavior of the File | Open dialog box coming up
stopped working so I deleted it. Should I be calling the super function
here?
It appears the only code my MFC project has is the document's Serialize
function. I set a breakpoint there but it isn't clear where it's getting
called from and who is setting the archive parameter passed into serialize
to open and save the document.
Anyway, I'm sure some MFC guru out there has been able to open a MFC
document before and can give me a clue. Thanks! :-)
To reopen the document, you can bypass the usual OnFileOpen open logic and
just call CDocument::OnOpenDocument directly, something like this (error
checking left as an exercise to the reader):
void CMyDoc::OnFileReopen()
{
// probably should call IsModified and warn the user if changes will
be lost
OnOpenDocument( GetPathName() );
CMainFrame *pFrame = static_cast<CMainFrame*>( AfxGetMainWnd() );
pFrame->InitialUpdateFrame( this, TRUE );
}
--Carter
"Darrell Reich" <dre...@maxwell.com> wrote in message
news:u27UKJhEAHA.250@cppssbbsa05...