PreviousNext
Macrovision

ListCount Example

InstallShield 2008 ยป InstallScript Language Reference

Note

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 ListCount function.

*

* The following adds the names of the program folders to a

* string list and then displays the number of strings in

* the list.

*

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

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

#include "Ifx.h"

export prototype ExFn_ListCount(HWND);

function ExFn_ListCount(hMSI)

    STRING svString;

    LIST   listID;

    NUMBER nCount;

begin

    // Create a string list.

    listID = ListCreate (STRINGLIST);

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

    if (listID = LIST_NULL) then

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

        abort;

    endif;

    // Get the names of the program folders into a list.

    GetGroupNameList (listID);

    // Count the number of program folders in the list.

    nCount = ListCount (listID);

    // Report error or display the folder count.

    if (nCount < 0) then

        MessageBox ("ListCount failed.", SEVERE);

    else

        SprintfBox (INFORMATION, "ListCount",

                        "There are %i program folders.", nCount);

    endif;

    // Remove the list from memory.

    ListDestroy (listID);

end;




Copyright Information | Contact Macrovision