Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to set default directory when using CFileDialog?

Posted on 2000-03-26
4
Medium Priority
?
282 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 200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

810 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