Thread: how do u open a folder?

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    3

    how do u open a folder?

    How do you open a folder using c++ i can open an exe file using the following but i cant workout how to open a specific folder. i.e c:\nic

    case 6: WinExec("control.exe date/time",SW_MAXIMIZE);
    break;

    would you have to change WinExec to something else or leave it as it is. i have tried WinRun even open but it says i have to declare them as variables.

    also if i put case 6: WinExec("A:\",SW_MAXIMIZE);
    break;

    it reads the a drive but dosent open it. which is very strange
    Please help

    Ta

  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    I'm not sure what you mean by opening a folder, or what you want to do with an open folder, but you could look at SetCurrentDirectory() in windows.h, or chdir() in direct.h.
    zen

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Just a thought.....when you say "open a folder" do you mean the same as say clicking on My Computer? An explorer window?

    If so try this;


    Code:
    WinExec("explorer.exe a:\\",SW_MAXIMIZE);
    Running the path as an argument to explorer.exe will open an explorer window to that dir....

    Also, dont forget the extra ' \ ' as it will class a single ' \ ' as an escape char....

    Hope it helps....

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    3
    thanx fordy it worked cheers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open Watcom CreateThread pointer parameter problems, m'kay?
    By Mad_guy in forum Windows Programming
    Replies: 2
    Last Post: 11-06-2005, 01:26 AM
  2. file doesn't open
    By jmoney in forum C Programming
    Replies: 6
    Last Post: 02-24-2003, 02:39 PM
  3. Problems with open and save boxes
    By pinkcheese in forum Windows Programming
    Replies: 3
    Last Post: 05-21-2002, 06:03 PM
  4. Programmatically open a Windows Folder
    By Shaman in forum Windows Programming
    Replies: 4
    Last Post: 09-25-2001, 03:39 PM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM