Click to See Complete Forum and Search --> : changing initial search directory


zach
March 31st, 1999, 09:06 AM
Hello. I have a button that upon pushing it, it opens a dialog box so a user can open a file. How can I specify in the code where I want the initial directory to start from? The files that go with the application are always in the same directory and I want to be able to specify this directory when the user first clicks on the button to open the file dialog box. THanks.

Kepa
April 23rd, 1999, 04:06 AM
Hi,

I suppose you are using CFileDialog class to do this, so:

CFileDialog MyOpenFileDialog (//parameters for constructor...//);
LPCTSTR MyPath = "c:\\MyFolder\\";
MyOpenFileDialog.m_ofn.lpstrInitialDir = MyPath;
MyOpenFileDialog.DoModal();

Hope it wil be useful.

Kepa Metola

April 23rd, 1999, 04:16 AM
Try SetCurrentDirectory(...)