When are the 4 BAFunctions kicked off?

Aug 12, 2013 at 6:31 PM
Hi

Trying to figure out when
OnDetect
OnDetectComplete
OnPlan
OnPlanComplete

are run when running the actual bundle?

thanks,

Steve
Coordinator
Aug 12, 2013 at 6:46 PM
OnDetect - runs as the install starts, before the UI is displayed.
OnDetectComplete - signals the completion of detect.
OnPlan - runs just before the packages are installed.
OnPlanComplete - signals the completion of Plan.

The most useful one is OnDetect as that can be used to setup the UI. I would use OnPlan if I needed to take the UI settings and translate them somehow into variables to send to the packages.
Aug 12, 2013 at 6:53 PM

Sigh… Nuts

So I guess OnPlan is run when you click the Install button?

So if I have the RadioButtons 1/2/3 then the BAFunction won’t work, I will have to change the Extended BA (but that is only for 1 install out of 6 J

I guess I could “write” it so IF RadioButton1 exists, RadioButton2 exists, RadioButton3 exists then change the LicenseURL name

Steve

Coordinator
Aug 12, 2013 at 7:01 PM
Correct.

There aren't really any other events I could hook in to and call the bafunctions.
Aug 15, 2013 at 4:15 AM

Hey Neil,

I have it sort of working… instead of using the OnClickhyperlinkeula I am using a OnClickRadiobutton1 etc… however it takes 2 clicks on the radio button to get it to work L any clue why?

case WM_COMMAND:

switch (LOWORD(wParam))

{

case WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX:

pBA->OnClickAcceptCheckbox();

return 0;

case WIXSTDBA_CONTROL_RADIOBUTTON1:

pBA->OnClickRadioButton1();

return 0;

case WIXSTDBA_CONTROL_RADIOBUTTON2:

pBA->OnClickRadioButton2();

return 0;

case WIXSTDBA_CONTROL_RADIOBUTTON3:

pBA->OnClickRadioButton3();

return 0;

then my onclick is:

//

// OnClickRadioButton1 - update the EULA.

//

void OnClickRadioButton1()

{

HRESULT hr = S_OK;

LPWSTR sczEULA_URL = NULL;

LPWSTR sczUnformattedText = NULL;

// check to see if we have radio buttons which means we are checking for the EULA variables

LONGLONG llRButton1 = 0;

if (SUCCEEDED(BalGetNumericVariable(L"RadioButton1", &llRButton1)))

{

if (llRButton1 == 1)

{

BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "RadioButton1 is: %d", (DWORD)llRButton1);

hr = BalGetStringVariable(L"EULA1", &sczUnformattedText);

if (SUCCEEDED(hr))

{

BalFormatString(sczUnformattedText, &sczEULA_URL);

BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "EULA URL is: %ls", sczEULA_URL);

hr = StrAllocString(&m_sczLicenseUrl, sczEULA_URL, 0);

BalExitOnFailure1(hr, "Failed to copy license URL: %ls", sczEULA_URL);

hr = m_pEngine->SetVariableString(L"WixExtbaLicenseUrl", sczEULA_URL);

BalExitOnFailure(hr, "Failed to set variable.");

MessageBox(NULL, "Setting EULA1", "Radio button1", MB_OK);

}

}

}

LExit:

ReleaseStr(sczEULA_URL);

ReleaseStr(sczUnformattedText);

SavePageSettings(WIXSTDBA_PAGE_INSTALL);

}

Coordinator
Aug 15, 2013 at 7:28 AM
I think you may also need to check HIWORD(wParam) to ensure you are getting the BN_CLICKED event, IIRC when you click a radio button you get a different message first.
Aug 15, 2013 at 3:09 PM

You mean like this? (still requires a dbl click L)

case WM_COMMAND:

if((HIWORD(wParam) == BN_CLICKED) && (LOWORD(wParam) == WIXSTDBA_CONTROL_RADIOBUTTON1))

{

pBA->OnClickRadioButton1();

return 0;

}

if((HIWORD(wParam) == BN_CLICKED) && (LOWORD(wParam) == WIXSTDBA_CONTROL_RADIOBUTTON2))

{

pBA->OnClickRadioButton2();

return 0;

}

if((HIWORD(wParam) == BN_CLICKED) && (LOWORD(wParam) == WIXSTDBA_CONTROL_RADIOBUTTON3))

{

pBA->OnClickRadioButton3();

return 0;

}

switch (LOWORD(wParam))

{

case WIXSTDBA_CONTROL_EULA_ACCEPT_CHECKBOX:

pBA->OnClickAcceptCheckbox();

return 0;

case WIXSTDBA_CONTROL_RADIOBUTTON1:

pBA->OnClickRadioButton1();

return 0;

case WIXSTDBA_CONTROL_RADIOBUTTON2:

pBA->OnClickRadioButton2();

return 0;

case WIXSTDBA_CONTROL_RADIOBUTTON3:

pBA->OnClickRadioButton3();

Coordinator
Aug 15, 2013 at 3:12 PM
Yes that's what I meant. No idea why it needs 2 clicks then, I'd probably start adding tracing or attach a debugger to see what is going on.
Aug 15, 2013 at 3:55 PM

Figured out why it took two clicks,

When in the OnClickRadioButtonx function I was saving the page settings AFTER setting the EULA variable

So click once radiobutton1 = 0 save page settings, click again NOW radio button1 =1 change the EULA variable

So now before I check the value of the radiobutton I save the page settings to update the value, only takes 1 click now J

Steve

Coordinator
Aug 15, 2013 at 3:59 PM
Glad you got it sorted. I did wonder if it might be simpler to just check which radio button is set in the hyperlink on click.
Aug 15, 2013 at 4:06 PM

Ya I might do that now that I know the issue was with the values not being set before checking for the value of the radio button 3 if statements in the hyperlink click instead of 3 new functions and 6 VM_Command case’s…

Steve

Aug 15, 2013 at 5:10 PM

Sweet, commented out the VM_Command stuff I did and the 3 onclickradiobuttonx functions

Moved them to the onclickhyperlinkeula function and it works J

Aug 17, 2013 at 3:02 PM

Neil,

Using your extended BA DLL I am trying to create a 2nd page.

I.e. Welcome page is to select the Client products to install (via check boxes) and then click Next to get the EULA page appear with the checkbox to agree to EULA and the install button

I have added a new page in the WixStandardBootstrapperApplication.cpp file and added it to my theme xml file:

However it is not working… is there no way to do that?

<Page Name="Install">

<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.InstallHeader)</Text>

<Text X="11" Y="-11" Width="-11" Height="-129" FontId="3" DisablePrefix="yes">#(loc.InstallMessage)</Text>

<Checkbox Name="RadioButton1" X="120" Y="170" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="no">#(loc.InstallRadioButton1)</Checkbox>

<Checkbox Name="RadioButton2" X="120" Y="190" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="no">#(loc.InstallRadioButton2)</Checkbox>

<Checkbox Name="RadioButton3" X="120" Y="210" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="no">#(loc.InstallRadioButton3)</Checkbox>

<!--<Hypertext Name="EulaHyperlink" X="11" Y="260" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallLicenseLinkText)</Hypertext>

<Checkbox Name="EulaAcceptCheckbox" X="11" Y="280" Width="246" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox>-->

<Text X="11" Y="-11" Width="246" Height="17" FontId="3" DisablePrefix="yes">#(loc.InstallVersion)</Text>

<Hypertext Name="UpgradeHyperlink" X="11" Y="-73" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallUpgradeLinkText)</Hypertext>

<Button Name="OptionsButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.InstallOptionsButton)</Button>

<Button Name="InstallNextButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallNextButton)</Button>

<Button Name="WelcomeCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallCancelButton)</Button>

</Page>

<Page Name="Options">

<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.OptionsHeader)</Text>

<Text X="11" Y="121" Width="-11" Height="17" FontId="3">#(loc.OptionsLocationLabel)</Text>

<Editbox Name="FolderEditbox" X="11" Y="143" Width="-91" Height="21" TabStop="yes" FontId="3" FileSystemAutoComplete="yes" />

<Button Name="BrowseButton" X="-11" Y="142" Width="75" Height="23" TabStop="yes" FontId="3">#(loc.OptionsBrowseButton)</Button>

<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.OptionsOkButton)</Button>

<Button Name="OptionsCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.OptionsCancelButton)</Button>

</Page>

<Page Name="License">

<Text X="11" Y="-11" Width="246" Height="17" FontId="3" DisablePrefix="yes">#(loc.InstallVersion)</Text>

<Text X="11" Y="80" Width="-11" Height="-70" TabStop="no" FontId="2" HexStyle="0x800000" DisablePrefix="yes" />

<Richedit Name="EulaRichedit" X="12" Y="81" Width="-12" Height="-71" TabStop="yes" FontId="0" />

<Checkbox Name="EulaAcceptCheckbox" X="-11" Y="-41" Width="260" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox>

<Button Name="OptionsButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.InstallOptionsButton)</Button>

<Button Name="InstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button>

<Button Name="LicenseCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallCloseButton)</Button>

</Page>

Coordinator
Aug 17, 2013 at 3:35 PM
I am afraid I have never done that but I would expect it to be possible using the similar code to the options dialog. Are you able to step through the code and see what happens when you click the Next button or is it failing to load the theme?
Aug 18, 2013 at 2:09 PM

I am not sure on how to debug a dll I will ask at work on Monday and see…

If it failed to load the theme I would expect it to crash before loading the GUI, right?

It is loading the “install” page and clicking Next is like clicking Install button L

Steve

Coordinator
Aug 18, 2013 at 2:26 PM
It sounds like you still have the InstallNextButton on click event linked to the install action.

As the UI is loading to debug you should be able to start the install and then use VS to attach to the running process.
Aug 18, 2013 at 3:38 PM

Thanks I will look into that tomorrow.

I wish there were more examples of WPF burn examples out there (not simple ones like the one in codeplex) L

Have a good evening

Steve

Aug 20, 2013 at 7:53 PM

Got it working J

Ended up using Extended BA DLL that I downloaded from you (I added a few things for radio buttons to be read so I could change the EULA based on which radio button was selected.

I also change the Success/Failure header based if it was an Install (Setup Succeeded) or an uninstall (Uninstall Succeeded)

Then I just changed the theme XML file, I removed the Options page section and renamed my License page section Options, I have a Next on the Install page and a Back button on the “options” page:

<Page Name="Install">

<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.InstallHeader)</Text>

<Text X="11" Y="-11" Width="-11" Height="-129" FontId="3" DisablePrefix="yes">#(loc.InstallMessage)</Text>

<Checkbox Name="RadioButton1" X="120" Y="170" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="no">#(loc.InstallRadioButton1)</Checkbox>

<Checkbox Name="RadioButton2" X="120" Y="190" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="no">#(loc.InstallRadioButton2)</Checkbox>

<Checkbox Name="RadioButton3" X="120" Y="210" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="no">#(loc.InstallRadioButton3)</Checkbox>

<Text X="11" Y="-11" Width="246" Height="17" FontId="3" DisablePrefix="yes">#(loc.InstallVersion)</Text>

<Hypertext Name="UpgradeHyperlink" X="11" Y="-73" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallUpgradeLinkText)</Hypertext>

<Button Name="OptionsButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.InstallOptionsButton)</Button>

<Button Name="WelcomeCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallCancelButton)</Button>

</Page>

<Page Name="Options">

<Text X="11" Y="-11" Width="246" Height="17" FontId="3" DisablePrefix="yes">#(loc.InstallVersion)</Text>

<Text X="11" Y="80" Width="-11" Height="-70" TabStop="no" FontId="2" HexStyle="0x800000" DisablePrefix="yes" />

<Richedit Name="EulaRichedit" X="12" Y="81" Width="-12" Height="-71" TabStop="yes" FontId="0" />

<Checkbox Name="EulaAcceptCheckbox" X="-11" Y="-41" Width="260" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox>

<Button Name="OptionsOkButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.OptionsOkButton)</Button>

<Button Name="InstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button>

<Button Name="WelcomeCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallCloseButton)</Button>

</Page>

That way I can accept what I have selected and click Agree and then Install OR click Back make changes and then click Next and select EULA and then click Install J

Steve