Retrieving the value of checkbox of DIalog in Installscript

1k Views Asked by At

How do I fetch the value of a checkbox in the installscript in Installshield?

Background : I have a checkbox which has property "UALCSTATUS" and its value is "ON" .in the Dialogs section . When I fetch the value in installscript using the following command, it fetches 0 or nothing (whether checked or unchecked)

MsiGetProperty(hMSI, "UALCSTATUS", szStrValue, nVal); 

Do I have to set a custom action when I check the checkbox so that I can set the value of "UALCSTATUS" property in order that it gets set to "ON" .

1

There are 1 best solutions below

0
On

Properties tied to check boxes in Windows Installer UI are set to values that evaluate to true or false. While you can tweak the exact value used for true/checked in the CheckBox table, a simpler approach would be to call MsiEvaluateCondition with a condition string of the name of the property, and compare it with MSICONDITION_TRUE (1):

if MsiEvaluateCondition(hMSI, "UALCSTATUS") = MSICONDITION_TRUE then
    : : :
endif;

Alternately for such a simple condition, you can just get the property as you described and compare it to an empty string. If it's empty, so is the check box. If it's set to anything else, the check box is checked.

As a side note, for a project using InstallScript-based UI, instead of checking properties, you'd be calling CtrlGetState to determine if the check box is checked. Typically this is then exposed through a byref parameter to the function that displays the dialog box.