CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: CFileDialog

  1. #1
    Join Date
    May 1999
    Location
    Fort Worth Texas
    Posts
    614

    CFileDialog

    I want the CFileDialog dialog to be looking at a predetermine folder whenit first opens instead of the folder that the application is running. How do I do that.


    Thanks

    Jim Bassett


  2. #2
    Guest

    Re: CFileDialog

    hai,

    CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );

    while creating a object for CFiledialog the third parameter in the constructor

    you pass you can give the path you required to come when the file dialog

    pops up.

    satish


  3. #3
    Guest

    Re: CFileDialog

    Hi!
    CFileDialog::m_ofn is a structure of type OPENFILENAME. Use this structure to initialize the appearance of a File Open or File Save As dialog box after it is constructed but before it is displayed with the DoModal member function. You can set the lpstrInitialDir member of m_ofn to the directory you want the dialog box to point to initially.


    The following code shd solve your problem :
    CFileDialog FilePath(TRUE);
    FilePath.m_ofn.lpstrInitialDir = "D:\\"; //Set the value of lpstrInitialDir to the predeterminate folder U want it to point to.
    FilePath.DoModal();

    Do let me know if it works.

    Regards,
    Sukanya Swaminathan
    Software Engineer
    Aditi Technologies
    Blr - 80
    Email :[email protected]



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured