在退出/结束对话框中显示动态内容 - WIX Installer

时间:2012-11-30 07:48:39

标签: wix custom-action wix3.6

我想根据实例报告在完成/退出对话框中显示消息。

安装时如果出现问题,我想在完成屏幕上显示错误消息,否则显示成功消息。

我正在调用自定义操作来验证实例,并根据它在Finish屏幕上设置变量的值。但每次在“完成”屏幕上,都会显示默认变量值。

在下图中没有替代,我想显示动态内容。

enter image description here

1 个答案:

答案 0 :(得分:1)

这是我的功能,可以在可滚动文本控件中显示动态许可协议。您可以使用其中一些来获得您想要做的事情:

 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);
}