I am using the following script to run an executable as an admin:
#include "ifx.h"
export prototype MyFunction(HWND);
///////////////////////////////////////////////////////////////////////////////
//
// Function: MyFunction
//
// Purpose: Calls into Companion to execute the detect camera and all init setup
// code
//
///////////////////////////////////////////////////////////////////////////////
function MyFunction(hMSI)
begin
if REMOVEALLMODE ==0 then //only run if they are installing the product
LAAW_SHELLEXECUTEVERB = "runas";
LaunchApplication (INSTALLDIR ^ "Companion.exe",
"-detect -test -wsdl -exit -nimbus",
"",
SW_NORMAL,
0,
LAAW_OPTION_WAIT_INCL_CHILD | LAAW_OPTION_USE_SHELLEXECUTE);
endif;
end;
On XP, the script above will open up a dialog box asking the user which user the executable should be run as. This allows them to select an admin to run the executable. However, on Windows 7, nothing happens. The installation doesn't ask the user for anything and the installation fails.
Any ideas on why this might be or any other suggestions as to how to run an executable as an admin?
What happens when you launch the application yourself under Win7, I mean outside of InstallShield?
I am thinking it might be due to UAC. A program launched by an installscript doesn not automatically inherit admin privileges from the installshield script.