CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Location
    Potsdam
    Posts
    110

    changing initial search directory



    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.

  2. #2
    Join Date
    Apr 1999
    Location
    (Bilbao) North of Spain
    Posts
    5

    Re: changing initial search directory

    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

  3. #3
    Guest

    Re: changing initial search directory

    Try SetCurrentDirectory(...)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured