Here is the typical pattern for using it:

// Make sure you use PMSIHANDLE and not MSIHANDLE for tableView and columns.
If you do have to use MSIHANDLE instead, set them both to NULL before the
first call to WcaAddTempRecord and call MsiCloseHandle on each of them after
the last call to WcaAddTempRecord.
PMSIHANDLE tableView;
PMSIHANDLE columns;
MSIDBERROR dbError(MSIDBERROR_NOERROR); // alternate syntax: MSIDBERROR
dbError = MSIDBERROR_NOERROR;
// You could also skip dbError and pass NULL where it occurs in the argument
list

// you don't want uiUniquifyColumn to be = 1 because that appends text to
the end of the LISTBOXVALUES string.
HRESULT hr = WcaAddTempRecord(&tableView, &columns, L"ListBox", &dbError, 0,
4, L"LISTBOXVALUES", 1, L"Item 1", L"Item 1");
// Test hr for success, bail if failure. You can use dbError in your error
report. To know which column the error is from, however, you will have to
call MsiViewGetError() again.
hr = WcaAddTempRecord(&tableView, &columns, L"ListBox", &dbError, 0, 4,
L"LISTBOXVALUES", 2, L"Item 2", L"Item 2");
// Test hr for success, bail if failure (same as above).
hr = WcaAddTempRecord(&tableView, &columns, L"ListBox", &dbError, 0, 4,
L"LISTBOXVALUES", 3, L"Item 3", L"Item 3");
// Test hr for success, bail if failure (same as above).

The tableView and columns handles will be closed for you when they go out of
scope if you made them PMSIHANDLEs.

What is the value of hr after each call to WcaAddTempRecord?

-----Original Message-----
From: Jiang, Chunyan (GE Healthcare) [mailto:chunyan.ji...@ge.com] 
Sent: Wednesday, November 11, 2009 4:40 AM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Question on Listbox

I would like to debug the custom action. But I don't know how to use
debugger. So I use MessageBox to show the value I am interested. 

The value of hTable and hColumns is:

 MSIHANDLE hTable = NULL;
 MSIHANDLE hColumns = NULL; 

I don't know detailed information for WcaAddTempRecord() function. I have
checked "wcautil.h". But there is no detailed description. In the sample in
Wix Tutorial, there is 8 parameters for WcaAddTempRecord. But it doesn't
pass the compile. So I added &error. I hope there is some details document
for this function. So I can understand it better.

Regards,

Chunyan

-----Ursprüngliche Nachricht-----
Von: Blair [mailto:os...@live.com] 
Gesendet: Dienstag, 10. November 2009 18:28
An: 'General discussion for Windows Installer XML toolset.'
Betreff: Re: [WiX-users] Question on Listbox

This is where you probably want to attach a debugger on your custom action.

I would be interested to know the values of both hResult and error (which is
an enumeration).
Also, before the first call to WcaAddTempRecord, what were the values of
hTable and hColumns?

-----Original Message-----
From: Jiang, Chunyan (GE Healthcare) [mailto:chunyan.ji...@ge.com]
Sent: Tuesday, November 10, 2009 6:56 AM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] Question on Listbox

Hi wix-users,
 
I want to use Listbox control to show some items on dialog. So I tried the
sample in WiX Tutorial 10.1
 
I changed the sample a little bit for passing build:
 
Add 

<Property Id="LISTBOXVALUES" Value="1"/>

To sampleListbox.wxs. Otherwise there is always error in verbose log that
control needs a property link to it.

And 

MSIDBERROR error;

hResult = WcaAddTempRecord (&hTable, &hColumns, L"ListBox", &error, 0, 3,
L"LISTBOXVALUES", 1, L"Item 1");

hResult = WcaAddTempRecord (&hTable, &hColumns, L"ListBox", &error, 0, 3,
L"LISTBOXVALUES", 2, L"Item 2");

hResult = WcaAddTempRecord (&hTable, &hColumns, L"ListBox", &error, 0, 3,
L"LISTBOXVALUES", 3, L"Item 3");

In the sample,  there is no "&error" parameter.

However, when I run the sample.msi, the listbox is empty. 

The hResult has the type HRESULT. I want to show hResult value in a
messagebox. So I add code:

wchar_t buffer[10];

swprintf_s( buffer, 10, L"%s", hResult );

ShowMessage.Append(buffer);

::MessageBoxW(NULL, ShowMessage, L"Fill Listbox", MB_OK);

And at last, the message shows (null).

What is wrong with WcaAddTempRecord ? How to add item to listbox control?

Best regards,

 

Chunyan

----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus
on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to