Thread: ShellExecute Help!!

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    8

    Question ShellExecute Help!!

    Hi
    I am having probs trying to code ShellExecute can anyone show me where I am going wrong. I have pasted offending code below. Thanx for your help.
    Shaman

    ofstream a_file("example.bat", ios::trunc );
    a_file<<s;
    a_file.close();
    HINSTANCE heh;
    heh = ShellExecute(NULL, "open", "C:\\bc45\bin", "",
    "c:\\bc45\bin\example.bat", SW_SHOW);

  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    You've got the file and directory parameters mixed up, try-

    heh = ShellExecute(NULL, "open", "example.bat", "",
    "C:\\bc45\\bin", SW_SHOW);

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    8

    Thumbs up

    Thanx zen you know I have been struggling for days on that. Thanx again

    Shaman

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Retrieving the handle of shellexecute
    By cloudy in forum Windows Programming
    Replies: 2
    Last Post: 08-21-2006, 09:01 AM
  2. ShellExecute, strange !!
    By BianConiglio in forum C Programming
    Replies: 2
    Last Post: 05-05-2004, 04:41 AM
  3. ShellExecute() string problem
    By henrikstolpe in forum Windows Programming
    Replies: 2
    Last Post: 05-21-2003, 09:54 AM
  4. ShellExecute and popups or MessageSending
    By Unregistered in forum Windows Programming
    Replies: 0
    Last Post: 01-03-2002, 09:50 AM