ListCreate Example

InstallShield 2014 ยป InstallScript Language Reference

Note: To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.

/*--------------------------------------------------------------*\

*

* InstallShield Example Script

*

* Demonstrates the ListCreate and ListDestroy functions.

*

* ListCreate is called to create a numbered list.  ListDestroy

* is called to destroy it.

*

\*---------------------------------------------------------------*/

 

// Include Ifx.h for built-in InstallScript function prototypes.

#include "Ifx.h"

 

export prototype ExFn_ListCreate(HWND);

 

function ExFn_ListCreate(hMSI)

    LIST listID;

    NUMBER nvItem;

begin

 

    // Create an empty number list.

    listID = ListCreate (NUMBERLIST);

 

    // If an error occurred, report it; then terminate.

    if (listID = LIST_NULL) then

        MessageBox ("Unable to create list.", SEVERE);

        abort;

    endif;

 

    // Add the number 1078 to the list.

    ListAddItem (listID, 1078, AFTER);

 

    // Add the number 304 to the list

    ListAddItem (listID, 304, AFTER);

 

    // Retrieve the current item in the list (304).

    ListCurrentItem (listID, nvItem);

 

    // Display the current item.

    SprintfBox (INFORMATION, "ListCreate",

               "Current item in list: %d", nvItem);

 

    // Retrieve the first item in the list (1078).

    ListGetFirstItem (listID, nvItem);

 

    // Display the first item.

    SprintfBox (INFORMATION, "ListCreate",

               "First item in list: %d", nvItem);

 

    // Remove the list from memory.

    ListDestroy (listID);

 

end;