Solved

HOWTO set FileDialog to open a specific directory?

Posted on 2001-06-25
4
442 Views
Last Modified: 2013-11-20
Hello!

I have a SDI Document/View MFC app and I would like that the Open  FileDialog and Save/Save as... FileDialog open on a default directory.

Thanks a lot!
0
Comment
Question by:jussara
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 12

Expert Comment

by:migel
ID: 6224848
Hi!
try this:

add command handler for ID_FILE_OPEN  to the your APP class:

void CMyApp::OnFileOpen()
{
     // TODO: Add your command handler code here
     CString newName = _T("C:"\*.*");
     if (!DoPromptFileName(newName, AFX_IDS_OPENFILE,
          OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, TRUE, NULL))
          return; // open cancelled
     
     OpenDocumentFile(newName);
}

0
 
LVL 12

Expert Comment

by:migel
ID: 6224851
of course use your path instead
C:\*.*
0
 
LVL 2

Accepted Solution

by:
Chandra V earned 50 total points
ID: 6226408
Assuming

CFileDialog myDlg;//Use your own

Use

myDlg.m_ofn.lpstrInitialDir="c:\\";// Use your Own

to set your initial directory.
0
 

Expert Comment

by:leowlf
ID: 6261081
Or

_chdir( "c:\\" );
CFileDialog myDlg(1);
myDlg.DoModal();
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 84
Excel Use VBA to get user's Mac Address for their computer 5 416
notReplace  challenge 53 153
JQuery serialize and unserialize 8 275
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question