Adding an Element to an Empty List

InstallShield 2024

The first string that you add to the list goes immediately after the head of the list. This string (String 1 in the sample code) becomes the current string in the list. The script fragment shown below results in a list like that depicted after it:

// Create the empty list of strings.

listID = ListCreate (STRINGLIST);

 

// Test for a valid list

if (listID = LIST_NULL) then

    MessageBox ("List not created", SEVERE);

else

    // Add a string to the list.

    szString = "String 1";

    ListAddString (listID, szString, AFTER);

endif;

String 1 is added to a list.