cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Shuttledude
Level 7

LaunchApplication fails to launch *.msi file

I am using the code snippet below in an attempt to launch an external *.msi installation process from within a basic msi, InstallShield 2009. The code is associated with a custom action, in the UI sequence. I know the CA is firing because I have a MessageBox (not shown in the code below) which shows me the value of szProgram, the path to the *.msi file.

The result is, I see the messagebox, the path is fine (no mispelled words, nothing wrong with the path or file name of the msi), but the result is exactly what you'd get if the msi file did not exist, was misspelled, or the path was wrong. I can launch the *.msi from Start / Run by using the very same path as szProgram has. But the msi will not launch from within the InstallShield basic msi app!!! I've tried using "" for the szDirectory, and also setting it to the same directory where the *.msi is located. Nothing works. Any suggestions? I've been staring at this for hours and have run out of guesses.

function LaunchMyProgram(hMSI)   
string szProgram, szCmdLine, szDirectory;
string szMsg;
string SETUPEXEDIR;
number nTimeOut;
number nBuffer;
begin
nBuffer = MAX_PATH + 1;
MsiGetProperty(ISMSI_HANDLE, "SETUPEXEDIR", SETUPEXEDIR, nBuffer);

nTimeOut = 2*60*1000; // defines a 2-minute wait period
szProgram = "msiexec.exe /I " + "\"" +
SETUPEXEDIR +
"\\MyDirectory\\MyProgram.msi" + "\"";
szCmdLine = "";
szDirectory = SETUPEXEDIR; // have also tried using szDirectory = ""
LaunchApplication(szProgram,
szCmdLine,
szDirectory,
SW_NORMAL,
nTimeOut,
LAAW_OPTION_WAIT);
end;
Labels (1)
0 Kudos
(1) Reply
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

The szProgram parameter to LaunchApplication is only intended to take the path/filename of the program to launch and all command line parameters would be passed in szCmdLine (see the CreateProcess doc on MSDN for more information, as these parameters are essentially passed to CreateProcess directly as the first two parameters). Alternately, it should be possible to pass an empty string ("") to szProgram and pass the entire command line to szCmdLine.
0 Kudos