This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Launch application as Administrator in Windows Vista
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 29, 2007
06:27 AM
Launch application as Administrator in Windows Vista
Hi all,
I am currently building an installation package. During the installation process, I need to launch an application with parameteres. Currently I am using the following lines to run the application:
if (LaunchApp("Iam.exe", "-a -b -c") < 0) then
MessageBox ("Unable to launch App.",SEVERE);
endif;
The application needs to run as administrator in Windows Vista in order to work properly. I have already set "Required Execution Level" to "Administrator" for the Setup.exe. There is no error during installation, but this application is not function correctly.
This is quite urgent. Any help is appreciated. Thanks in advance.
Richard
I am currently building an installation package. During the installation process, I need to launch an application with parameteres. Currently I am using the following lines to run the application:
if (LaunchApp("Iam.exe", "-a -b -c") < 0) then
MessageBox ("Unable to launch App.",SEVERE);
endif;
The application needs to run as administrator in Windows Vista in order to work properly. I have already set "Required Execution Level" to "Administrator" for the Setup.exe. There is no error during installation, but this application is not function correctly.
This is quite urgent. Any help is appreciated. Thanks in advance.
Richard
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 29, 2007
07:21 AM
I'd recommend using LaunchAppAndWait() or LaunchApplication(). Calling LaunchApp will launch the specified application, and continue execution, which doesn't really give you a chance to check the return code of the app, or anything.
From the InstallScript Help Library:
...so if LaunchApplication() with the parameter LAAW_OPTION_WAIT returns <0, then you can print out a debugging message with the return value of the launched app, "LAAW_PARAMETERS.nLaunchResult."
Hope that helps.
M<
From the InstallScript Help Library:
If the application cannot be launched, the LAAW_PARAMETERS system variable’s nLaunchResult member contains the result of calling the Windows API function GetLastError after the CreateProcess or ShellExecuteEx call. If the function is successful and the LAAW_OPTION_WAIT option was specified, the LAAW_PARAMETERS system variable’s nLaunchResult member contains the return code of the launched application.
...so if LaunchApplication() with the parameter LAAW_OPTION_WAIT returns <0, then you can print out a debugging message with the return value of the launched app, "LAAW_PARAMETERS.nLaunchResult."
Hope that helps.
M<
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 29, 2007
07:55 PM
Actually I used function LaunchAppAndWait() first. But there won't be any error message. The application can be executed. But it won't work if executed as per normal. It works only when executed as administrator. That's the tricky part.:(
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 30, 2007
02:38 AM
You can launch the executable by using the ShellExecuteEx Windows API with 'runas' for the lpVerb variable. Works for me.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 30, 2007
09:21 AM
Additionally, any CA that requires Administrative Privs should be run "Deferred in system Context." I've had the same problem with a dll call.
![](/skins/images/089A6DFE1F4989CB8CCC689A38D62C96/responsive_peak/images/icon_anonymous_message.png)