Custom Dialog Listbox
Posted 09 March 2005 - 08:00
I have a custom dialog with three controls on it. An EditBox, a ADD button and a ListBox. What I want is to add the text present in the EditBox to the ListBox on the ADD button event. But the problem is that I don't know how to add text to the list box.
I tried searching on the net but all I could find was the reference to the page http://www.installshield.com/news/newsletter/0302-articles/msiaccess.asp which uses VBScript to do the same taske.
If I make use of the VBScript I should make sure that the Script engine exists on the target machine, which I want to avoid.
Is there any other way of doing this????
With thanks & regards.
Posted 09 March 2005 - 16:15
szTitle = "";
szMsg = "";
listStartCopy = ListCreate( STRINGLIST );
// If an error occurred, report it; then terminate.
if (listStartCopy = LIST_NULL) then
MessageBox ("Unable to create list.", SEVERE);
//The following is an example of how to add a string(svName) to a list(listStartCopy).
ListAddString(listStartCopy," " + svName,AFTER);
ListAddString(listStartCopy," " + INSTALLDIR,AFTER);
ListAddString(listStartCopy,"Features To Be Installed:",AFTER);
nResult = SdStartCopy( szTitle, szMsg, listStartCopy );
Posted 10 March 2005 - 04:34
Could you please give the link to the topic.
In the example posted by jrcoldinmn, I have a doubt.
I have a list box control that I had defined as:
#define SD_LISTBOX_LICENSEKEY 1205
Now how do I associate this list listStartCopy created in the example with SD_LISTBOX_LICENSEKEY.
Posted 10 March 2005 - 04:47
We can create the list using ListCreate.
Then populate it with the ListAddString and finally link it with the listbox control using the function:
CtrlSetList (szDialogName, nControlID, listID);
Edited by Gadlakha, 10 March 2005 - 04:48.