File Open Dialog - Programmer

This is a discussion on File Open Dialog - Programmer ; Hello, I am very new to MFC and have to change an existing project using MFC. How to change the initial directory of an open file dialog? The program jumps directly to CWinApp::OnFileOpen() in appdlg.cpp when clicking on appropriate the ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: File Open Dialog

  1. File Open Dialog

    Hello,

    I am very new to MFC and have to change an existing project using MFC.
    How to change the initial directory of an open file dialog?
    The program jumps directly to CWinApp::OnFileOpen() in appdlg.cpp when
    clicking on appropriate the menu item.

    Thanks for help!

    Chris


  2. Re: File Open Dialog

    "The program jumps directly to CWinApp::OnFileOpen() in appdlg.cpp when
    clicking on appropriate the menu item" is irrelevant to your question.

    Look into the body of CWinApp::OnFileOpen() and you should find:

    CFileDialog dlg( ...);
    ....
    INT_PTR res = dlg.DoModal();

    -------

    To change the initial directory, set dlg.m_ofn.lpstrInitialDir before
    calling dlg.DoModal().

    ie.

    dlg.m_ofn.lpstrInitialDir = LPCTSTR(GetFolderPath(CSIDL_PERSONAL));

    INT_PTR res = dlg.DoModal();


    --
    ---------------------------------------------------------------------
    DataGet® & PocketLog® www.dataget.com
    Data Collectors www.baxcode.com
    --------------------------------------------------------------------


    "beuzel" wrote in message
    news:1143719404.721595.275070@v46g2000cwv.googlegr oups.com...
    > Hello,
    >
    > I am very new to MFC and have to change an existing project using MFC.
    > How to change the initial directory of an open file dialog?
    > The program jumps directly to CWinApp::OnFileOpen() in appdlg.cpp when
    > clicking on appropriate the menu item.
    >
    > Thanks for help!
    >
    > Chris
    >




+ Reply to Thread