09.12.2012 Views

InstallShield 2012 Spring Express Edition User Guide

InstallShield 2012 Spring Express Edition User Guide

InstallShield 2012 Spring Express Edition User Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 10: Customizing Installation Behavior<br />

Using Custom Actions<br />

Note: <strong>InstallShield</strong> sequences the serial number DLL file custom action after any user-defined custom actions. Thus, if you<br />

add your own custom action and schedule it after the Customer Information dialog, the installation launches this custom<br />

action before the serial number DLL file custom action.<br />

Custom Action Gallery<br />

The Custom Action gallery contains preconfigured custom actions that achieve common functionality.<br />

The custom actions contained in this gallery do not require any input from you. They are designed to be<br />

added to your installation project and run during installation. To insert an action from your gallery into<br />

your installation, right-click one of the items in the Custom Actions view, point to Add from Gallery, and<br />

then click the custom action that you want to add to your project.<br />

Currently, the only action listed in this gallery is Schedule Reboot at End action. If you add this action to<br />

your project, it is automatically added to the After Setup Complete Success dialog part of the installation.<br />

This action forces the target machine to reboot after the installation completes, allowing .dll files and<br />

other files to register with the system at startup. Changing any of this custom action’s settings or<br />

scheduling it for a different part of the installation is not recommended. For example, if you reschedule<br />

it, your installation may cause the target machine to restart before the file transfer has completed.<br />

Checking if a Product Is Installed<br />

The following code will check if a product with a ProductCode of {8FC71000-88A0-4B41-82B8-<br />

8905D4AA904C} is installed on the machine. This code can be used as a New Style DLL Custom Action.<br />

UINT __stdcall CheckProduct(MSIHANDLE hInstall)<br />

{<br />

int RetVal = 0;<br />

RetVal = MsiQueryProductState("{8FC71000-88A0-4B41-82B8-8905D4AA904C}");<br />

if (RetVal==5))<br />

{<br />

MessageBox(GetForegroundWindow(),TEXT("Installed"),TEXT("My Product"), MB_OK);<br />

return 1;<br />

}<br />

else<br />

{<br />

MessageBox(GetForegroundWindow(),TEXT("Not Installed"),TEXT("My Product"), MB_OK);<br />

return 0;<br />

}<br />

}<br />

The following table lists the return values of MsiQueryProductState:<br />

Table 10-2: Return Values of MsiQueryProductState<br />

Return Value Description<br />

–1 The product is neither advertised nor installed.<br />

1 The product is advertised but not installed.<br />

2 The product is installed for a different user.<br />

<strong>InstallShield</strong> <strong>2012</strong> <strong>Spring</strong> <strong>Express</strong> <strong>Edition</strong> <strong>User</strong> <strong>Guide</strong> ISE-1900-UG00 233

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!