cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Nicolasb
Pilgrim

Serial number validation dll

Hi,
I want to create my own dll to validate the serial number entered in the CustomerInformation dialog. Where should I put the dll in the project (SUPPORTDIR?) and how do I call it through a custom action ?
I searched the website about this problem and I only found information related to InstallShield 2008 Express (here) and I did not found the field the authors refers to.
Thanks,
Labels (1)
0 Kudos
17 Replies
gridman
Pilgrim

Re: Serial number validation dll

Since a DLL is really an assembly, then it may need to be placed in its own component (with nothing else in the component).

I think what you are saying would work. You would want to create an InstallScript custom action and first load the DLL, call the serial number validation function, then unload the DLL.

I think some people place a Validate button in the CustomerInformation dialog. When the user clicks the button, you have a DoAction behavior on the Validate button that calls the custom action. You would also attach a condition to the Next button that the user can't move forward until he has validated the serial number. You could do this by checking if a property has been set (your validate function would set the property if the validation has passed).
0 Kudos
Nicolasb
Pilgrim

Re: Serial number validation dll

Thanks, I've already implemented something to validate the serial number on the next button event. About the idea of putting the DLL in a component I'll try it, but how would I acces it at run-time ? The components are not copied to disk yet at this moment during the installation.
0 Kudos
gridman
Pilgrim

Re: Serial number validation dll

I don't understand your question.

If you put the DLL in a component, and attach no conditions to it (the component), and point the component destination to say [INSTALLDIR], then there is no reason why it wouldn't be copied to your target folder upon installation.
0 Kudos
Nicolasb
Pilgrim

Re: Serial number validation dll

The validation of the serial occurs before the files are copied to disk.
0 Kudos
gridman
Pilgrim

Re: Serial number validation dll

Pardon me, I made a mistake. What you said makes perfect sense.

So then, you are correct. You would need to place the DLL in the SupportFiles/Language Independent folder. That is where the files will be extracted to during the installation. Then in the custom action, you would build a path to the DLL using the SUPPORTDIR variable.

How about that?
0 Kudos
Nicolasb
Pilgrim

Re: Serial number validation dll

Ok Good! I should install the files in the SUPPORTDIR. That was my first question.

Now, the second part of my question. How may I call the DLL via a Custom Action ? I can launch a CA at the right moment during install, but I can't make that CA to launch a dll stored in SUPPORTDIR.
0 Kudos
gridman
Pilgrim

Re: Serial number validation dll

First I would probably create an InstallScript function in the InstallScript view. Call it something like ValidateSerialNumber. At this point you could make it an empty function. Just a frame so you could create the custom action.

Then create an InstallScript custom action that uses the ValidateSerialNumber function.

If you placed a Validate button in the CustomerInformation dialog, then you would need to go to the Dialogs view, expand the CustomerInformation dialog, click Behaviors, then click on the Validate button. Then create a DoAction event with the argument ValidateSerialNumber and a Condition of 1. So, when the user clicks the Validate button, the custom action will be called.

Now, go back to the ValidateSerialNumber InstallScript function, call UseDll() to load the DLL, then call the validate function in your DLL, then call UnUseDLL() to unload the DLL, and pass the result back to the installer. Maybe create a property and set the property based on the result of the validate function, then don't let the user go forward (when hitting Next), until the property is set to the correct value.

Something like that.
0 Kudos
gridman
Pilgrim

Re: Serial number validation dll

I've thought about this a lot because I had to do the same thing for my own project. This seemed like the best way to go.

Other people may have other ideas.
0 Kudos
klacounte
Pilgrim

Re: Serial number validation dll

Nicholasb, if you're using a Windows Installer based project you can just put the DLL in the Binary table then the Windows Installer will handle the extract & loading of your DLL.
0 Kudos