tekomino
Posts: 9
Joined: Sat Dec 01, 2007 1:45 pm

Serial validation template & custom DLL validation probl

I am using the Custom DLL validation for serial number.

My serials are either 9 or 10 digits long. While I can specify the Template <##########> which accepts 10 digits it will not accept 9 digits. And if I specify the 9 digits template the 10 digits are not accepted.

The problem is that the Installer it seems first verifies the serial entered against Template and only if that validation passed it calls the DLL validation function.

I cannot find a way to enable 9 and 10 digit serials to be validated. I replaced the Masked Edit with standard Text Box and while I can enter any value the internal validation against the Template is still going on and is throwing the message that serial is not valid even before calling my custom validation DLL function.

Any suggestions on how to workaround this problem?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

I'm afraid that this cannot be done because Windows Installer does not support masked edit controls with a variable length.

I recommend that you use a single possible length for your serial numbers (either 9 or 10).

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tekomino
Posts: 9
Joined: Sat Dec 01, 2007 1:45 pm

Cosmin,

Thank you for following up on this.

It is actually not an issue with the masked edit control. I removed it and replaced it with the text box so it is out of picture.

The problem is that the Template value entered on the Serial Validation page is used first to check the entered PIDKEY and only after that validation is passed the custom DLL serial validation is called. I think that this is limitation of Advanced Installer and it should not be done that way.

Can I ask you to log this as feature request so the validation based on the template is NOT done if one uses custom DLL serial validation. There is really no point and it just limits us.

I solved the problem by introducing the PIDKEY2 property. I replaced the masked edit on UserRegistrionDlg with text box and I've bound text box to PIDKEY2 property.

The Template on Serial Validation I set to <##> then on UserRegistrionDlg InitEvents I set PIDKEY=99 so your internal validation passes at all times.

In my Custom DLL I validate key based on PIDKEY2 property which is now passed directly to my DLL. This works fine so I hope it helps somebody who runs into same problem.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,
Can I ask you to log this as feature request so the validation based on the template is NOT done if one uses custom DLL serial validation.
Thank you for your suggestion.

I'm afraid that this cannot be done because the Windows Installer masked edit control needs to have a template (it cannot have an empty template).

Since the masked edit is used for the serial number validation feature, you must specify a template for it.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
tekomino
Posts: 9
Joined: Sat Dec 01, 2007 1:45 pm

Cosmin,

Yes I understand that and you can keep that Template.

What I am saying is that Template should not be used for validation of PIDKEY if ones uses Custom DLL for validation. The Masked edit is not in picture here since I removed it.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

The PIDKEY property is used by the default masked edit control in the "UserRegistrationDlg" dialog. Since the masked edit needs a template, it's property (PIDKEY) must be validated using the template.

This is normal Windows Installer behavior and it is used to make sure that the serial number which will be validated by a custom DLL or an algorithm has the correct form.

Since the PIDKEY property is linked to the masked edit control and the masked edit control allows a pre-validation of the serial number, we cannot remove the template validation of the PIDKEY property.

If you do not want to use this feature then you can use a custom control that gets the serial number and delivers it to the DLL.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”