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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 10: Customizing Installation Behavior<br />

Using Custom Actions<br />

• Custom Actions During Installation—Actions that are scheduled during this run-time category are<br />

launched during a first-time installation of the product.<br />

• Custom Actions During Maintenance—Actions that are scheduled during this run-time category are<br />

launched during modify mode and repair mode; they are also launched when the product is silently<br />

uninstalled.<br />

• Custom Actions During Uninstallation—Actions that are scheduled during this run-time category are<br />

launched when the product is being uninstalled.<br />

Using a Custom Action for Serial Number Validation<br />

Serial number validation requires the use of a custom DLL file. Example code for this type of DLL file is<br />

available in the following location:<br />

<strong>InstallShield</strong> Program Files Folder\Samples\WindowsInstaller\ValidateSerialNumber<br />

In this example, the serial number must take the following format:<br />

Field1-1505-XXXXXXXXXX<br />

The first section must appear as it does above, although it is not case-sensitive. The second section, 1505,<br />

must be a number evenly divisible by 5 (for example, 1111 would not work). The last section can be any<br />

10 alphanumeric characters. Keep in mind that this format is merely an example. Your serial number<br />

function can take any format that you would like it to have.<br />

Filter the Input Characters<br />

To filter the input from illegal characters, enter ??????-####-?????????? in the Serial Number Template<br />

field for the Customer Information dialog in the Dialogs view. The question marks (?) signify<br />

alphanumeric characters and the number signs (#) signify numbers. By setting the template in this<br />

manner, your serial number field is separated into three parts, and each section is filtered for different<br />

types of input.<br />

Further Considerations<br />

The Validate Function, Success Return Value, and Retry Limit properties allow you to further customize<br />

how your serial number validation DLL file works. For the Validate Function property, enter the name of<br />

the function within your .dll file that validates the serial number provided by the end user.<br />

Your .dll file should return a specific value every time it is run. The example .dll included with<br />

<strong>InstallShield</strong> returns 1 on success and –1 on failure. Therefore, type 1 in the Success Return Value field.<br />

When you write your own .dll file, the success return value can be whatever you choose, as long as it is<br />

non-zero.<br />

The Retry Limit property lets you set how many failed attempts are allowed. For example, if you only<br />

want users to be able to try entering a serial number three times, type 3 in this field. After the third failed<br />

attempt, the installation exits.<br />

The example .dll file contains a user interface element that breaks down the entered serial number and<br />

displays it to the user. Additionally, it displays the section, if any, of the serial number that is incorrect.<br />

This display is useful when testing and troubleshooting your serial number verification .dll file, but it<br />

should not be left in the final version of your installation.<br />

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

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

Saved successfully!

Ooh no, something went wrong!