Thread: Win2k SetCurrentDir

  1. #1
    Unregistered
    Guest

    Win2k SetCurrentDir

    SetCurrentDirectory(strCurrentDir);

    Does not work in W2k.

    I call this from OnFileOpen.. any way to overcome this problem



    void MyApp::OnFileOpen(){ char szCurrentDir[MAX_PATH]; ::GetCurrentDirectory(MAX_PATH, szCurrentDir); // switch to the default folder// THis also does not work GetMainFrame()->SetDefaultExperimentFolder();// THis does not work ::SetCurrentDirectory(GetMainFrame()->GetDataDirectory()); CWinApp::OnFileOpen(); ::SetCurrentDirectory(szCurrentDir);}

  2. #2
    Unregistered
    Guest

    Talking Do this!!

    Did you do this, otherwise try it!!

    #include <direct.h>

    int main()
    {
    int drive = 2; // Or whatever drive you want, this is C: for me
    if (! _chdrive(drive))
    { cerr << "Unable to locate current drive" << endl; }
    return 0;
    }


    this should work, and you current drive should be C:, within this function...

  3. #3
    Unregistered
    Guest

    Talking

    If you arent talking about programming in a console, then forget about the last post.

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    It should work ok.....

    More likely you are passing an incorrect param to the function...

    Put the params in a messagebox each time you call them to see if any stray " marks have entered there......also call GetLastError after each call to SetCurrentDirectory() to see what grumbles the system may have....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WIN2k equiv
    By jinx in forum Tech Board
    Replies: 3
    Last Post: 05-13-2004, 01:27 PM
  2. win2k dns lookup
    By serrrrrver in forum Tech Board
    Replies: 11
    Last Post: 01-13-2003, 12:50 PM
  3. DOS resolution problem in Win2k
    By charisma in forum C Programming
    Replies: 2
    Last Post: 12-27-2002, 05:04 AM
  4. SAM Win2k File
    By (TNT) in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 02-28-2002, 01:15 PM
  5. Problem with Win2k Professional...
    By Brian in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 01-26-2002, 05:28 PM