InstallShield 2016 » InstallScript Language Reference
Project • This information applies to the following project types:
• | InstallScript |
• | InstallScript MSI |
The OnBegin event handler responds to the Begin event, the first redefinable event in a setup. Code that must be executed before anything else in the script should be included in this handler. For example, you can verify that the user's machine meets your product's system requirements here.
OnBegin is prototyped for you when you include iswi.h or ifx.h in your script. Define OnBegin in your script as in the following example:
#include "iswi.h"
function OnBegin( )
// local variables
begin
// beginning code
end;
For example, an OnBegin function that verifies a particular registry key exists before continuing the installation might appear as follows:
// abort installation if HKLM\Software\InstallShield does not exist
function OnBegin( )
NUMBER nReturn;
begin
// set the root key
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
// check for the existence of the subkey
nReturn = RegDBKeyExist("Software\\InstallShield");
if (nReturn < 0) then
MessageBox("Your system does not meet the system requirements. " +
"Setup will now exit.", SEVERE);
abort;
endif;
end;
Code in this event handler is always executed, even during a maintenance setup or uninstallation, unless you place it inside the following if-then structure:
if (!MAINTENANCE) then
// non-maintenance code
endif;
The setup sets the system variable MAINTENANCE equal to FALSE the first time the setup is run, and TRUE every time the setup is run thereafter.
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |