This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Run an application after install.
Started by
scotty
, Apr 29 2003 10:13
6 replies to this topic
Posted 29 April 2003 - 10:13
Hi
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;
begin
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);
else
MessageBox ("not yet", INFORMATION);
endif;
return ERROR_SUCCESS;
end;
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?
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;
begin
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);
else
MessageBox ("not yet", INFORMATION);
endif;
return ERROR_SUCCESS;
end;
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
Forgot to mention, build does throw the warning 4095, but since I a'int using any of the SOURCEDIR, TARGETDIR, etc. I guess I should be ignoring it. Right??
Posted 29 April 2003 - 14:13
That's because at this time the InstallScript engine is already shut down.
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.
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.
Stefan Krüger
InstallSite.org twitter facebook
Posted 30 April 2003 - 06:08
The KB article is at :
http://support.insta...ticleid=q104449
Couldn't there be a way of doing this without using Orca? Better yet programmatically if not do-able at design time?
http://support.insta...ticleid=q104449
Couldn't there be a way of doing this without using Orca? Better yet programmatically if not do-able at design time?
Posted 30 April 2003 - 08:25
Not in the old "Installshield for Windows Installer". It would be possible in InstallShield Developer.
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)
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)
Stefan Krüger
InstallSite.org twitter facebook
Posted 23 July 2003 - 17:25
Hi Stefan,
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
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
Posted 24 July 2003 - 21:13
I'd prefer calling the ShellExecute WinAPI (using custom action type "call standard dll" for that purpose.
Stefan Krüger
InstallSite.org twitter facebook