x5657
x5657

Reputation: 1212

In InstallShield, how to change the value of my Property before it is used by SQL Text Replacement?

What I want to do

In InstallShield I want to set the value of a Property before it is used by the SQL Text Replacement feature. I want the new Property value to come from an Edit control that I've added to a dialog.

What I've done so far

I have added SQL Scripts to my InstallShield project, which include placeholders for InstallShield's Text Replacement feature. I've used the Text Replacement tab to find and replace a placeholder in the SQL script with the value of a Property that I've added to the Property Manager. This works correctly, but only for the Property's default value.

Where I'm stuck

The problem is that I want the new value to come from an Edit control in my custom Dialog, but I can't find a way to do this. Text Replacement always uses the Property's default value.

What I've tried is the following InstallScript, which runs when the user clicks Next on my custom Dialog:

CtrlGetText("MyDialog", EDIT_VALUE_FROM_USER, svValueFromUser);
MsiSetProperty ( hwndDlg, "EDIT_VALUE_FROM_USER", svValueFromUser);

Where EDIT_VALUE_FROM_USER is my Property. This runs without error, but the value doesn't come through to the final SQL script.

Why isn't the new value for EDIT_VALUE_FROM_USER being used by SQL Text Replacement? How can I diagnose why it's not working? Should I be doing this in a completely different way?

Upvotes: 0

Views: 1939

Answers (2)

x5657
x5657

Reputation: 1212

This turned out to be because I wasn't using the system property ISMSI_HANDLE.

So the correct code to write a Property from an Edit control in a custom dialog is:

CtrlGetText("MyDialog", EDIT_VALUE_FROM_USER, svValueFromUser);
MsiSetProperty (ISMSI_HANDLE, "EDIT_VALUE_FROM_USER", svValueFromUser);

Upvotes: 1

Christopher Painter
Christopher Painter

Reputation: 55601

I'm guessing your property isn't listed in the SecureCustomPublicProperties property and is getting set back to it's default value when the installer transitions to the install execute sequence. A log file of the installation would give more data to work with.

Upvotes: 0

Related Questions