Run an application after install.
Posted 29 April 2003 - 10:13
I wish to run an application (cmd line : "startApp.exe abc xyz") when I click on Finish button on SetupCompleteSuccess dialog. I could've created a CA that "launches an executable". But doing this shows up the ugly DOS box when I click on Finish. So, that is not acceptable.
To get around this, I created a CA "StartApp" that's an Installscript function as shown below.
function StartApp (hMSI)
STRING szProgram, szCmdLine, szDir;
NUMBER nWait, nShow, nTimeOut, nvExitCode;
NUMBER nResult, nvSize;
nvSize = 256;
MessageBox ("Starting Application", INFORMATION);
MsiGetProperty (hMSI, "INSTALLDIR", szDir, nvSize);
szProgram = szDir ^ "bin" ^ "startApp.exe";
szCmdLine = "abc xyz"; // some valid params for startApp.exe
nWait = WAIT;
nShow = SW_HIDE;
nTimeOut = -1;
nResult = _LaunchAppEx (szProgram, szCmdLine, nWait, nShow, nTimeOut, nvExitCode);
if (nResult == 0) then
MessageBox ("launched", INFORMATION);
MessageBox ("not yet", INFORMATION);
For your info, _LaunchAppEx function is the same written by Stefan Krueger that can be found on the InstallSite site. Passing SW_HIDE to this function does not show up the DOS box.
So now, I included this custom action as a control event for the Finish button as "DoAction -> StartApp -> 1". (For your info btw, I need the condition as LAUNCHPROGRAM=1 where LAUNCHPROGRAM is the property associated with the CheckLaunchProgram checkbox on the last page.)
But when I click the Finish button, this CA is not getting launched at all. Even the first message box ("Starting Application") is not appearing.
Any ideas why? Any other way of doing this?
Posted 29 April 2003 - 10:16
Posted 29 April 2003 - 14:13
I believe there's a knoweldge base article at http://kb.installshield.com that has some information about this and how to restart the engine.
Posted 30 April 2003 - 08:25
You can of course modify the .msi file using a VBScript or writing a small program that calls MSI APIs. There are some samples in the Windows Installer SDK, as well as full documentation.
Remark: a better approach would be to launch en exe instrad of a batch file, so that the DOS box doesn't come up at all. This would save you the overhead of using InstallScript (which includes installing the InstallScript engine on the target machine)
Posted 23 July 2003 - 17:25
even i have a similar kind of requirement , where in i need to
launch home page when finish button is pressed.
i was not able to locate or find the article which
says about how to re-start the engine.
pl let me know