1

I want to show messages on finish/exit dialog based on the instance report.

While installing if something goes wrong, I want to show error message on Finish screen else show success message.

I am calling a custom action to validate the instance and based on that sets the value of variable on Finish screen. But every time on Finish screen, default variable value is displayed.

In place of none in below image, i want to show dynamic content.

enter image description here

Sunil Agarwal
  • 4,097
  • 5
  • 44
  • 80
  • Can't answer right now, but I am not sure that property values are "passed back" to the GUI (InstallUISequence) after the InstallExecuteSequence has finished. I suppose you could write to HKCU or a file and read back? Probably better ways. [Not sure if the path to the log file is available](https://stackoverflow.com/a/54458890/129130) at that point either: [MsiLogFileLocation](https://learn.microsoft.com/en-us/windows/desktop/msi/msilogfilelocation). – Stein Åsmul Aug 10 '20 at 11:01
  • Thanks for response. As such we have stopped using WIX. Can't try now – Sunil Agarwal Aug 17 '20 at 16:49

1 Answers1

1

Heres my function to display a dynamic license agreement into a Scrollable Text Control. You may be able to use some of it to get what you want to do:

 extern "C" UINT __stdcall GetLicense(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
BYTE* pbData = NULL;
DWORD cbData = 0;
LPWSTR szValueBuf = NULL;
char szDistributorName[MAX_PATH];
PMSIHANDLE hView, hRecord;
CString szLicense;

hr = WcaInitialize(hInstall, "GetLicense");
ExitOnFailure(hr, "Failed to initialize");

WcaLog(LOGMSG_STANDARD, "Initialized.");

hr = ExtractBinary(L"License", &pbData, &cbData);
ExitOnFailure(hr, "failed to extract binary data");

hr = WcaGetProperty(L"DISTRIBUTORNAME", &szValueBuf);
ExitOnFailure(hr, "Failed to get the driver information");

wcstombs(szDistributorName, szValueBuf, 260);
szLicense = pbData;

int nRet = szLicense.Replace("[DISTRIBUTORNAME]", szDistributorName);

LPCTSTR query = _T("SELECT * FROM `Control` ")
    _T(" WHERE `Dialog_` = 'LicenseAgreementDlg' AND `Control` = 'LicenseText' ");
UINT ret = MsiDatabaseOpenView(WcaGetDatabaseHandle(), query, &hView);

if (ERROR_SUCCESS != ret)
{
    return ERROR_INSTALL_FAILURE;
}

ret = MsiViewExecute(hView, 0);

if (ERROR_SUCCESS != ret)
{
    return ERROR_INSTALL_FAILURE;
}


ret = MsiViewFetch(hView, &hRecord);

if (ERROR_SUCCESS != ret)
{
    return ERROR_INSTALL_FAILURE;
}

ret = MsiViewModify(hView, MSIMODIFY_DELETE, hRecord);

if (ERROR_SUCCESS != ret)
{
    return ERROR_INSTALL_FAILURE;
}

ret = MsiRecordSetStringA(hRecord, 10, szLicense);

if (ERROR_SUCCESS != ret)
{
    return ERROR_INSTALL_FAILURE;
}

ret = MsiViewModify(hView, MSIMODIFY_INSERT_TEMPORARY, hRecord);

if (ERROR_SUCCESS != ret)
{
    return ERROR_INSTALL_FAILURE;
}

return ERROR_SUCCESS;

LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
Natalie Carr
  • 3,707
  • 3
  • 34
  • 68