This is working code for a list that already has an item.
LONG insert_index = index;
for each (const std::wstring& name in names)
{
// the first record is inserted at index 2, there's at least one
default item in the view
MsiHandle hRec(MsiCreateRecord(4));
CHECK_WIN32_DWORD(MsiRecordSetString(hRec, 1, listbox.c_str()),
L"MsiRecordSetString(1) failed"); // Column1: Property
tied to the entry
CHECK_WIN32_DWORD(MsiRecordSetInteger(hRec, 2, insert_index),
"MsiRecordSetInteger(2) failed"); // Column2: Display
order of the item
CHECK_WIN32_DWORD(MsiRecordSetString(hRec, 3, name.c_str()),
"MsiRecordSetString(3) failed"); //Column3: Value to
set property to
CHECK_WIN32_DWORD(MsiRecordSetString(hRec, 4, name.c_str()),
L"MsiRecordSetString(4) failed"); //Column4: Display
text for item
CHECK_WIN32_DWORD(MsiViewModify(msiView, MSIMODIFY_INSERT_TEMPORARY,
hRec),
"MsiViewModify failed");
insert_index ++;
}
>From http://msiext.codeplex.com, look for SQLDMO_ListAvailableSQLServers.
dB. @ dblock.org
Moscow|Geneva|Seattle|New York
-----Original Message-----
From: Jiang, Chunyan (GE Healthcare) [mailto:[email protected]]
Sent: Tuesday, November 10, 2009 9: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
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users