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

MsiSetProperty in OnFirstUIAfter() doesn't work

I create a new InstallShield MSI project and added MsiSetProperty(ISMSI_HANDLE, "REBOOT", "Force") in OnFirstUIAfter() event handler. But it doesn't work. However it works on my custom action which is the last custom action in Execute subitem (i.e. it is placed after ISSelfRegisterFinalize).

Code:
function OnFirstUIAfter()
STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
NUMBER bOpt1, bOpt2;

begin
Disable(STATUSEX);

bOpt1 = FALSE;
bOpt2 = FALSE;

if ( BATCH_INSTALL ) then
SdFinishReboot ( szTitle , szMsg1 , SYS_BOOTMACHINE , szMsg2 , 0 );
else
SdFinish ( szTitle , szMsg1 , szMsg2 , szOpt1 , szOpt2 , bOpt1 , bOpt2 );
endif;

MsiSetProperty(ISMSI_HANDLE, "REBOOT", "Force");

end;


After completing installation (SdFinish), I would like to prompt the user to reboot. When the prompt message is appeared and I press the Yes button, reboot action doesn't happen. However, from my log file, I see the REBOOT property is indeed changed from Suppress to Force. It's very weird.

As I know, OnFirstUIAfter is deferred execution.
This problem bothers me over one month. Any help is appreciated.
Labels (1)
0 Kudos
(7) Replies
Not applicable

By this point, the Windows Installer process has relinquished its control and the InstallScript engine owns the installation, so you want to use InstallScript to trigger the reboot.
0 Kudos
Marcus_Chuang
Level 4

Hi, bryanwolf:
Thanks for your reply. I know Installscript would trigger the reboot action when BATCH_INSTALL is set to true. However, I want to create another dialog to prompt users to reboot. That would make users know rebooting their PC is essential. This idea is from some software installations. I'm very curious how they could do it.
0 Kudos
Not applicable

Is there a reason the SdFinishReboot can't deliver that information and functionality for you?
0 Kudos
Marcus_Chuang
Level 4

SdFinishReboot with BATCH_INSTALL=FALSE could inform users the setup process has been completed. SdFinishReboot with BATCH_INSTALL=TRUE could inform users the setup completion and reboot their PCs in one dialog.

Now, My requirement is:
step 1: Use SdFinishReboot with BATCH_INSTALL=FALSE to inform users the setup process has been completion.
step 2: After the above dialog, I want to create "another dialog" to prompt users to reboot their PCs, just like the above attached image.

I couldn't find a solution for step 2. Is it clear? Thanks for your help.
0 Kudos
Marcus_Chuang
Level 4

Anyone could help me?
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

You could try using the standard SdFinish dialog instead of SdFinishEx, and then call AskYesNo to determine if the user wants to reboot. If yes, then call the System function passing SYS_BOOTMACHINE (this is basically what SdFinishReboot does). Note that you will also want to set BATCH_INSTALL to TRUE if the OnRebooted event needs to run after the reboot.
0 Kudos
Marcus_Chuang
Level 4

Thanks a lot. 🙂 It works...
0 Kudos