Adding an Element Before the Current Element

InstallShield 2025

If the current string is the first string in the list and you add a new string before it, the new string becomes the first string in the list. The string that was formerly in the first element position now resides in the second element position. The new string at the first element position is now the current string:

// 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 some strings to the list.

    szString = "String 1";

    ListAddString (listID, szString, AFTER);

 

    szString = "String 2";

    ListAddString (listID, szString, BEFORE);

endif;

String 2 is added before String 1.