Solved

How to set default directory when using CFileDialog?

Posted on 2000-03-26
4
270 Views
Last Modified: 2013-11-20
hi,

how do I set the default directory (e.g. "c:\temp") when I create the CFileDialog?

I cannot find the method.. pls help..
thanks!

0
Comment
Question by:Haho
  • 2
4 Comments
 

Accepted Solution

by:
krisp earned 50 total points
ID: 2659598
Hi,

CFileDialog dlg(....);
dlg.m_ofn.lpstrInitialDir = "c:\temp";

Hope this helps

cheers
 
0
 
LVL 1

Author Comment

by:Haho
ID: 2659669
shucks! ok. i will try it..
thank you.
0
 
LVL 3

Expert Comment

by:kulina
ID: 2659676
krisp's answer worked for me just fine.
But you have to make sure to do it this way:
CFileDialog dlg;
dlg.m_ofn.lpstrInitialDir = "c:\\temp";

.... in other words to put TWO slashes between directory names, since '\' (slash) is a special character in C\C++.
(Credits to krisp - Thanx krisp);

0
 
LVL 1

Author Comment

by:Haho
ID: 2663083
thxs
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now