Function : Text List Manipulation

ListAllocate - Create a text list.
----------------------------------------------------------------------------------------------------------

#include <textlist.h>

STATUS LNPUBLIC ListAllocate(
WORD ListEntries,
WORD TextSize,
BOOL fPrefixDataType,
DHANDLE far *rethList,
void far *retpList,
WORD far *retListSize);

Description :

This function creates a text list structure in memory that can be populated with multiple text strings to create a text list. It takes as input the number of entries to create in the list, a total size to allocate for text storage, and a flag indicating whether to allocate an extra WORD for the Domino data type prefix. It allocates and locks a block of memory and initializes the memory with a LIST structure and, optionally, the Domino data type word. It returns a handle to the Text List memory object, a pointer to the Text List, and the overall size of the memory object.

Upon successful return, the list memory object is locked and a pointer to the object is returned in addition to the object's handle. Since the object is returned locked, you must explicitly unlock the object (OSUnlockObject) before attempting to free it (OSMemFree).

Call ListAddText to store up to the specified number of entries in the list. Call ListAddEntry to add more entries to the list than the number specified by num_entries.

If you append the text list to a document using a function that copies the memory, such as NSFItemAppend, then you must subsequently unlock and free the memory yourself. If you append the text list to a document using a function that takes ownership of the memory, such as NSFItemAppendByBLOCKID or MailAddRecipientsItem, then unlock the memory but do not free it.

Parameters :

Sample Usage :


error = ListAllocate(0, 0, TRUE, &hRecipientsItem, &RecipientsItem,
                   &RecipientsItemSize);
if (error) goto Close;
OSUnlockObject(hRecipientsItem);

while (fgets(String, sizeof(String), ForeignFile))
{
   Code = String[0];
   Value = &String[1];
   ValueLength = strlen(Value);

   error = ListAddEntry(hRecipientsItem, TRUE,
           &RecipientsItemSize, Recipients,
           Value, ValueLength);
}
error = MailAddRecipientsItem(hMessage, hRecipientsItem, RecipientsItemSize);
if (error) goto Close;
hRecipientsItem = NULLHANDLE;


See Also :

ListAddText
----------------------------------------------------------------------------------------------------------