Thank you very much! This is exactly what I wanted!
However now I'm having trouble trying to get public properties from the MSI
because of string conversions. I'm so lost.
Here's a snippet of my code:
{
....
DWORD lengthOfGettingStuff;
LPWSTR gettingStuff = L"";
MsiGetProperty (hInstall, TEXT("TESTPROPERTY"), gettingStuff,
&lengthOfGettingStuff);
...
LPCSTR test = CW2A(gettingStuff);
string test2 = test;
test2 =
"{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fswiss\\fcharset0
Arial;}}\\viewkind4\\uc1\\pard\\f0\\fs20 "+test2+"\\par}";
LPCSTR test5 = test2.c_str();
ret = MsiRecordSetStringA(hRecord, 10, test5);
...
}
The property was set to a value of 1
The text box looks really messed up. It looks something like this:
ýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ
Chesong Lee wrote:
>
>
> Here is a code snippet in my ReplaceEula Custom Action.
> This is not a part of the full working code but you may understand the
> logic to change text in ScrollableText. This custom action is an immediate
> custom action and sequenced before the main dialog.
>
> I hope this helps for your needs.
>
> Regards,
>
> Chesong Lee
>
>
> UINT __stdcall
> ReplaceEula(MSIHANDLE hInstall)
> {
> //
> // Fill lpEula in RTF format as you wish
> //
> // EULA File Content is MBCS (RTF) not Unicode
> //
> XTL::AutoProcessHeapPtr<CHAR> lpEula = pReadEulaFromFile(hInstall);
> if (NULL == (LPSTR) lpEula)
> {
> pMsiLogMessage(
> hInstall,
> _T("EULACA: ReadEulaFromFile failed, error=0x%X"),
> GetLastError());
>
> return ERROR_INSTALL_FAILURE;
> }
>
> //
> // Replacing EULA text control in the database
> //
> PMSIHANDLE hDatabase = MsiGetActiveDatabase(hInstall);
>
> if (0 == hDatabase)
> {
> pMsiLogMessage(
> hInstall,
> _T("EULACA: MsiGetActiveDatabase failed, error=0x%X"),
> GetLastError());
>
> return ERROR_INSTALL_FAILURE;
> }
>
> PMSIHANDLE hView;
> LPCTSTR query = _T("SELECT * FROM `Control` ")
> _T(" WHERE `Dialog_` = 'LicenseAgreement' AND `Control` =
> 'Memo' ");
> UINT ret = MsiDatabaseOpenView(hDatabase, query, &hView);
>
> if (ERROR_SUCCESS != ret)
> {
> pMsiLogMessage(
> hInstall,
> _T("EULACA: MsiDatabaseOpenView failed, error=0x%X"),
> ret);
>
> return ERROR_INSTALL_FAILURE;
> }
>
> ret = MsiViewExecute(hView, 0);
>
> if (ERROR_SUCCESS != ret)
> {
> pMsiLogMessage(
> hInstall,
> _T("EULACA: MsiViewExecute failed, error=0x%X"),
> ret);
>
> return ERROR_INSTALL_FAILURE;
> }
>
> PMSIHANDLE hRecord;
> ret = MsiViewFetch(hView, &hRecord);
>
> if (ERROR_SUCCESS != ret)
> {
> pMsiLogMessage(
> hInstall,
> _T("EULACA: MsiViewFetch failed, error=0x%X"),
> ret);
>
> return ERROR_INSTALL_FAILURE;
> }
>
> ret = MsiViewModify(hView, MSIMODIFY_DELETE, hRecord);
>
> if (ERROR_SUCCESS != ret)
> {
> pMsiLogMessage(
> hInstall,
> _T("EULACA: MsiViewModify failed, error=0x%X"),
> ret);
>
> return ERROR_INSTALL_FAILURE;
> }
>
> //
> // 10th field is the Text column
> //
> // Dialog_, Control, Type, X, Y,
> // Width, Height, Attributes, Property, Text
> // Control_Next, Help
> //
> ret = MsiRecordSetStringA(hRecord, 10, lpEula);
>
> if (ERROR_SUCCESS != ret)
> {
> pMsiLogMessage(
> hInstall,
> _T("EULACA: MsiRecordSetString failed, error=0x%X"),
> ret);
>
> return ERROR_INSTALL_FAILURE;
> }
>
> //
> // Commit the changes temporarily
> //
> ret = MsiViewModify(hView, MSIMODIFY_INSERT_TEMPORARY, hRecord);
>
> if (ERROR_SUCCESS != ret)
> {
> pMsiLogMessage(
> hInstall,
> _T("EULACA: MsiViewModify failed, error=0x%X"),
> ret);
>
> return ERROR_INSTALL_FAILURE;
> }
>
> pMsiLogMessage(
> hInstall,
> _T("EULACA: EULA is replaced successfully."));
>
> return ERROR_SUCCESS;
> }
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of JosephMM
> Sent: Monday, August 21, 2006 3:00 PM
> To: [email protected]
> Subject: [WiX-users] WcaAddTempRecord with ScrollableText
>
>
> Since the Text attribute does not accept properties I was hoping to use a
> Custom Action to adjust the text based on the value of a bunch of public
> properties. I was looking through the Wix
> Tutorial(http://www.tramontana.co.hu) and found a Custom Action that was
> changing some Text of a
> ListBox(http://www.tramontana.co.hu/wix/lesson10.php).
>
> Right now I'm starting simple. I was just trying to figure out how to set
> the Text attribute of the ScrollableText Control with WcaAddTempRecord()
> instead of a ListBox like in lesson 10. Is it possible to use
> WcaAddTempRecord() to change the Text attribute? If so, then how? If not,
> then are there any alternatives?
>
> I am using Wix 2.0 and I linked the DLL I made with the WiX *.lib files
> and
> the msi.lib file
>
> Here is my broken code:
>
> extern "C" UINT __stdcall FillListbox (MSIHANDLE hInstall) {
> HRESULT hResult = WcaInitialize (hInstall, "testText");
> if (FAILED (hResult)) return ERROR_INSTALL_FAILURE;
>
> MSIHANDLE hTable = NULL;
> MSIHANDLE hColumns = NULL;
>
> hResult = WcaAddTempRecord (&hTable, &hColumns, L"ScrollableText", 0, 2,
>
> L"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0
> Arial;}}
> \viewkind4\uc1\pard\f0\fs20 My Text\par}");
>
> if (hTable)
> MsiCloseHandle (hTable);
> if (hColumns)
> MsiCloseHandle (hColumns);
> return WcaFinalize (hResult);
> }
>
> and here is my Dialog from my .wxs file:
> ...
> <UI>
> <Dialog Id="WelcomeDialog" Width="370" Height="270"
> Title="[ProductName]
> [Setup]" NoMinimize="yes">
>
> <Control Id="Exit" Type="PushButton"
> X="236" Y="243" Width="56" Height="17"
> Disabled="no"
> Default="yes" Text="Exit">
> <Publish Event="EndDialog" Value="Exit" >1</Publish>
> </Control>
>
> <Control Id="FilledListbox" Type="ListBox"
> Sorted="yes" Property="LISTBOXVALUES"
> X="10" Y="50"
> Width="200" Height="130" />
>
> <Control Id="testText" Type="ScrollableText" Text="1"
> X="10" Y="10"
> Sunken ="yes" Disabled="no"
> Width="300" Height="200">
> </Control>
>
> </Dialog>
> </UI>
> ...
>
> and here is the error i recieved in the log file:
> testText: Error 0x8007064f: failed to open view on database
> testText: Error 0x8007064f: failed to openexecute temp view with query
> SELECT * FROM `ScrollableText`
>
> I appreciate any information you can give me on how to use the
> WcaAddTempRecord. Thank you!
> --
> View this message in context:
> http://www.nabble.com/WcaAddTempRecord-with-ScrollableText-tf2142018.html#a5912684
> Sent from the wix-users forum at Nabble.com.
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> WiX-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> WiX-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
--
View this message in context:
http://www.nabble.com/WcaAddTempRecord-with-ScrollableText-tf2142018.html#a5970286
Sent from the wix-users forum at Nabble.com.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users