cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
LKM_N4EN
Level 6

Disable Parent Dialog?

My project need to display an askOption dialog at the end of installation to let user choose drivers to install from the option list. At the same time, the setup should be able to detect if the drivers has installed in user machine then the option should be disabled.

To create the dialog, I refer to the installscript "AskOptions". Everything working fine as expected.

However I just discovered that the "AskOption" dialog is actually on top of the parent installation dialog, which means that at the same time user can have two dialog displayed (in my case, the dialogs are AskOption dialog and SetupProgress Dialog). Is there anyway that I can disable the parent dialog or to make the "AskOption" dialog always stick with the parent dialog?

The second problem is the "cross" on upper right corner of dialog. I tried to make it return ERROR_INSTALL_USEREXIT if user close the dialog, but it did not work. My coding as following:

nReturn = AskOptions (nValue, szMsg,
szText1, nvCheck1,
szText2, nvCheck2,
szText3, nvCheck3,
szText4, nvCheck4,
szText5, nvCheck5,
szText6, nvCheck6);

if (nReturn = DLG_CLOSE)
EndCurrentDialog();
return ERROR_INSTALL_USEREXIT;
endif;
Labels (1)
0 Kudos
(11) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

It sounds like you're trying to mix Basic MSI dialogs with InstallScript dialogs. This is generally a painful process and I'm not certain it's possible to get fully correct in the general case. My recommendation (assuming this is a Basic MSI project) is to create a custom MSI dialog that functions like your AskOptions call, and wire it up as a normal MSI dialog instead of what I assume is a ControlEvent custom action.
0 Kudos
LKM_N4EN
Level 6

I tried to use create dialog in basic msi project, but having limited reference to do what the installscript could do. That's why I am using installscript function as custom action to call up the dialog.

You mentioned 'ControlEvent' custom action and wire up as normal msi dialog. could you please elaborate the details? I could not catch what you mean.

Is there any other way to call up AskOption dialog from basic msi project?
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

I don't think I can do it more justice than other posts out there, and the InstallShield Help, but here's the quick start. In the Installation Designer tab, you can go under the Dialogs view and create a new dialog. Once there you can click on the subnode marked with a language to edit it and add buttons, etc., to it. And then you can go to the subnode marked Behavior to set ControlEvents. Set up the navigation between dialogs using NewDialog, NameOfDialog, 1 for the three columns; be sure to modify the dialogs you want to be adjacent if you didn't sequence it in the wizard.

As far as making this do what you wanted AskOptions for, what is your goal - do you wish to set a single MSI property to one of several values, or to set several MSI properties respectively to 1 or {} (undefined)?
0 Kudos
LKM_N4EN
Level 6

MichaelU wrote:

As far as making this do what you wanted AskOptions for, what is your goal - do you wish to set a single MSI property to one of several values, or to set several MSI properties respectively to 1 or {} (undefined)?


I would like to get the return value if the checkbox is set and pass as parameter to command line. So I guess i should use different property for each checkbox. Here is my installscript code:


function ExFn_AskOptions(hMSI)
STRING szMsg, szText1, szText2, szText3, szText4;
NUMBER nReturn, nValue;
begin
szMsg = "Select from the options below.";
szText1 = "Option1";
szText2 = "Option2";
szText3 = "Option3";
szText4 = "Option4";

nvCheck1 = TRUE;
nvCheck2 = TRUE;
nvCheck3 = TRUE;
nvCheck4 = TRUE;

DetectDriver();
if (Option1_Installed) then
nvCheck1 = FALSE;
endif;
if (Option2_Installed) then
nvCheck2 = FALSE;
endif;
if (Option3_Installed) then
nvCheck3 = FALSE;
endif;
if (Option3_Installed) then
nvCheck4 = FALSE;
endif;

Disable (BACKBUTTON);
Disable (CANCELBUTTON);
nValue = NONEXCLUSIVE;
nReturn = AskOptions (nValue, READER_SELECT_MSG,
szText1, nvCheck1,
szText2, nvCheck2,
szText3, nvCheck3,
szText4, nvCheck4);
end;


The following function is used to pass the parameter:

function InstallDriver(hMSI)
STRING szApplicationPath, szApplicationCmdLine, szApplicationCmdLine1;
STRING szCmdLine;
begin
ExFn_AskOptions(hMSI);

szApplicationPath = "MSIexec.exe";
szApplicationCmdLine = " /qb /i "+ SUPPORTDIR^"Integrator.msi";

//Add the reader name into cmd line if selected
if ( nvCheck1 = TRUE) then
szApplicationCmdLine1 = szApplicationCmdLine1+",option1";
endif;

if ( nvCheck2 = TRUE) then
szApplicationCmdLine1 = szApplicationCmdLine1+",option2";
endif;

if ( nvCheck3 = TRUE) then
szApplicationCmdLine1 = szApplicationCmdLine1+",option3";
endif;

if ( nvCheck4 = TRUE) then
szApplicationCmdLine1 = szApplicationCmdLine1+",option4";
endif;

szCmdLine = szApplicationCmdLine + szApplicationCmdLine1;
if (LaunchAppAndWait ("",szApplicationPath+szCmdLine,LAAW_OPTION_WAIT|LAAW_OPTION_SHOW_HOURGLASS) < 0) then
MessageBox ("Unable to launch "+ szCmdLine +".",SEVERE);
endif;
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

Right. If you use a different property for each checkbox, then you can replace your tests in InstallDriver() with either a call to MsiGetProperty and comparison to an empty string or something like:
if ( MSICONDITION_TRUE = MsiEvaluateCondition(hMsi, "CHECKBOX1PROPERTY") )then ...
0 Kudos
LKM_N4EN
Level 6

thanks Michael!
Jus another question.. if you see my function ExFn_AskOptions(), I try to search if the particular driver has been installed in user machine, then the checkbox will not be enabled by default.

But in MSI dialog, i can only either set the checkbox default to true or false, not using conditional statement?
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

You can set the value of the associated property before the dialog is displayed. People often do this with a System Search, but it's also possible with custom actions if the detection is not, for example, a registry or file presence query.
0 Kudos
LKM_N4EN
Level 6

MichaelU wrote:
You can set the value of the associated property before the dialog is displayed. People often do this with a System Search, but it's also possible with custom actions if the detection is not, for example, a registry or file presence query.


The detection of driver can be done using System Search. But I am having problem on setting the value of property. After I created the dialog, the associate checkbox property is displayed in "Property Manager" with default value "0".

What's the value that I should set to the property if the driver is detected and I want to uncheck the checkbox? This could be done using MsiSetProperty to set the value?
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

Checkboxes use defined/undefined properties instead of 1/0, so try deleting the property from the property manager.
0 Kudos
LKM_N4EN
Level 6

Oh no.. I still need the property for this purpose:

if ( MSICONDITION_TRUE = MsiEvaluateCondition(hMsi, "CHECKBOX1PROPERTY") )then ...
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

That's fine; the evaluation you show will be identical to the way the checkbox evaluates whether it should be drawn checked or not. A property that's not in the property manager (and not otherwise defined at runtime) is considered undefined.
0 Kudos