MRU file crash - Programmer

This is a discussion on MRU file crash - Programmer ; In my MDI CRichEditDoc/View app, if I try to open a Most Recently Used file from the menu and it has been deleted then my program crashes! I've spent hours tonight trying to see what is going wrong and I ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: MRU file crash

  1. MRU file crash

    In my MDI CRichEditDoc/View app, if I try to open a Most Recently Used
    file from the menu and it has been deleted then my program crashes!

    I've spent hours tonight trying to see what is going wrong and I don't
    seem to be able to remedy the problem. I've been stepping through
    CWinApp::OpenDocumentFile() and thought that overriding my
    OnOpenDocument() might fix it but it doesn't:

    BOOL CMyRichEdDoc::OnOpenDocument(LPCTSTR lpszPathName)
    {
    if(!GetFile(lpszPathName, CFile::modeRead, NULL)
    return FALSE;

    if(!CRichEditDoc::OnOpenDocument(lpszPathName))
    return FALSE;

    return TRUE;
    }

    Can anybody make some suggestions because I'm getting desperate!

    Adrian.

  2. Re: MRU file crash

    Could the problem be that GetFile is throwing an exception because the file
    has been deleted and you're not handling it since you've passed NULL in for
    the CFileExecption* parameter?

    Pete Mourfield

    "Adrian Gibbons" wrote in message
    news:34a2acd5.0405021539.7b91bfd9@posting.google.c om...
    > In my MDI CRichEditDoc/View app, if I try to open a Most Recently Used
    > file from the menu and it has been deleted then my program crashes!
    >
    > I've spent hours tonight trying to see what is going wrong and I don't
    > seem to be able to remedy the problem. I've been stepping through
    > CWinApp::OpenDocumentFile() and thought that overriding my
    > OnOpenDocument() might fix it but it doesn't:
    >
    > BOOL CMyRichEdDoc::OnOpenDocument(LPCTSTR lpszPathName)
    > {
    > if(!GetFile(lpszPathName, CFile::modeRead, NULL)
    > return FALSE;
    >
    > if(!CRichEditDoc::OnOpenDocument(lpszPathName))
    > return FALSE;
    >
    > return TRUE;
    > }
    >
    > Can anybody make some suggestions because I'm getting desperate!
    >
    > Adrian.




+ Reply to Thread