Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to set default directory when using CFileDialog?

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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: 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…
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.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

636 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