Yes, after extensive research I found it is possible to hide the Text
based on a RegistrySearch
. First you need to download the WiX Extended Bootstrapper Application from http://wixextba.codeplex.com/. Extract the contents and add to your project the WixBalExtensionExt.dll
as shown in Bundle10.wxs
example.
Then, open the project bafunctions
under folder Template bafunctions
. You will need to compile this C++ library and add it to your bundle as a Payload
(use the Bundle10.wxs
as example).
Then, to be able to read and hide the Text
control, uncomment function OnDetectComplete()
and add the following code, for example:
STDMETHODIMP OnDetectComplete()
{
HRESULT hr = S_OK;
LPWSTR sczValue = NULL;
#if DEBUG
// Show log info during debug.
// May not be THE way to log.
size_t i;
LPSTR sczValue2 = (char *) malloc(100);
#endif
BalGetStringVariable(L"InstalledDotNet4Reg", &sczValue);
BalExitOnFailure(hr, "Failed to get variable.");
if (sczValue == NULL)
{
BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD,
"Failed to read null variable.");
}
else
{
if (_wtoi(sczValue))
{
hr = m_pEngine->SetVariableString(L"CheckboxDotNetv4State",
L"disable");
BalExitOnFailure(hr, "Failed to set control state.");
hr = m_pEngine->SetVariableNumeric(L"CheckboxDotNetv4", 0);
BalExitOnFailure(hr, "Failed to set variable.");
}
else
{
#if DEBUG
// Log information
wcstombs_s(&i, sczValue2, (size_t)100, sczValue, (size_t)100);
BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, sczValue2);
#endif
hr = m_pEngine->SetVariableString(L"InstalledDotNet4State",
L"disable");
BalExitOnFailure(hr, "Failed to set control state.");
}
}
LExit:
ReleaseStr(sczValue);
return hr;
}
Finally, change (or add) your RegistrySearch
, this way:
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Classes\Installer\Products\FCDAC0A0AD874C333A05DC1548B97920"
Variable="InstalledDotNet4Reg" Result="exists" />