#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    London
    Posts
    13
    Rep Power
    0

    Question Running a child process


    Hi Guys, I need to run a exe file.
    I can get the pat of the file:
    AnsiString EXEPath = ExtractFilePath(Application->ExeName )+"\\TMSlite\\setup.exe";

    Now I dont know how to run this setup.exe.

    I was trying to use execv etc but with no luck.:mad:
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    Use the CreateProcess(), WinExec() or even the system() function.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    London
    Posts
    13
    Rep Power
    0
    Thanks a lot. Code below is doing the job.

    if(FileExists(const AnsiString "g:\\TMSliteSetup.exe"))
    {
    SHELLEXECUTEINFO execinfo ;
    memset (&execinfo, 0, sizeof (execinfo)) ;
    execinfo.cbSize = sizeof (execinfo) ;
    execinfo.lpVerb = "open" ;
    execinfo.lpFile = "g:\\TMSlite\\setup.exe";
    execinfo.fMask = SEE_MASK_NOCLOSEPROCESS ;
    execinfo.nShow = SW_SHOWDEFAULT ;
    ShellExecuteEx (&execinfo) ;
    }

IMN logo majestic logo threadwatch logo seochat tools logo