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