cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
heko_76
Level 4

Launch an Application

I am using Installshield professional 2008 .I want to install an exe which is will come in the custom option of the setup type.

I wrote the neccessary code in the Program_installed event
The PROGRAM is pointing to a exe on the local file system.


function Program_Installed()
NUMBER nWait;
begin

//if (LaunchAppAndWait (PROGRAM, "", nWait) < 0) then
if (LaunchApp (PROGRAM,"") < 0) then
MessageBox ("Unable to launch "+ PROGRAM +".",SEVERE);
endif;
end;
But it always gives me an error. says cannot launch exe.Please help asap
Labels (1)
0 Kudos

(2) Replies
William-Webb
Level 4

Hi,

First of all check that the file exists. Even if your 100% sure it does, it's always a good check to make!


nReturn = Is( FILE_EXISTS, sYourProgram );
MessageBox( "File Exist returns: " + FormatMessage( nReturn ), WARNING );
if ( nReturn = 1 ) then
nReturn = LaunchAppAndWait( sYourProgram, "", LAAW_OPTION_WAIT );
MessageBox( "LaunchAppAndWait returns: " + FormatMessage( nReturn ), WARNING );
endif;


FormatMessage() will turn the return value into a string telling you what a function returned. I personally don't use it as I use the debugger, but it might help you!

Where abouts are you calling this bit of code? Are you certain it's called AFTER the file has been installed?

Let us know what the two calls return!
0 Kudos
heko_76
Level 4

Hi William,

thanks for your help it worked
The first called returned "Invalid Function" and the second one returned
"The operation completed successfully".


I am trying to install files lke creating a directory structure then installing a third party exe file so am calling this under onFirstAfterUI() event so at the end of the progress screen this shall call the third party exe and install it...

Have a great week end

thanks,
Hemant.


William-Webb wrote:
Hi,

First of all check that the file exists. Even if your 100% sure it does, it's always a good check to make!


nReturn = Is( FILE_EXISTS, sYourProgram );
MessageBox( "File Exist returns: " + FormatMessage( nReturn ), WARNING );
if ( nReturn = 1 ) then
nReturn = LaunchAppAndWait( sYourProgram, "", LAAW_OPTION_WAIT );
MessageBox( "LaunchAppAndWait returns: " + FormatMessage( nReturn ), WARNING );
endif;


FormatMessage() will turn the return value into a string telling you what a function returned. I personally don't use it as I use the debugger, but it might help you!

Where abouts are you calling this bit of code? Are you certain it's called AFTER the file has been installed?

Let us know what the two calls return!
0 Kudos