ListValidType Example

InstallShield 2024 » InstallScript Language Reference

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

*

* InstallShield Example Script

*

* Demonstrates the ListValidType function.

*

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

 

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

#include "Ifx.h"

 

function OnBegin()

    LIST listID;

    number nListValidType;

begin

    // Create an empty 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;

 

    // Check whether the list ID is valid and what type it is.

    nListValidType = ListValidType (listID, NUMBERLIST);

    if (nListValidType >= ISERR_SUCCESS) then

        MessageBox ("List ID is valid and is a number list.",

            INFORMATION);

    else

        nListValidType = ListValidType (listID, STRINGLIST);

        if (nListValidType >= ISERR_SUCCESS) then

            MessageBox ("List ID is valid and is a string list.",

                INFORMATION);

        else

            MessageBox ("List ID is not valid.", INFORMATION);

        endif;

    endif;

 

   // Remove the list from memory.

    ListDestroy (listID);

 

    // Check whether the list ID is valid and what type it is.

    nListValidType = ListValidType (listID, NUMBERLIST);

    if (nListValidType >= ISERR_SUCCESS) then

        MessageBox ("List ID is valid and is a number list.",

            INFORMATION);

    else

        nListValidType = ListValidType (listID, STRINGLIST);

        if (nListValidType >= ISERR_SUCCESS) then

            MessageBox ("List ID is valid and is a string list.",

                INFORMATION);

        else

            MessageBox ("List ID is not valid.", INFORMATION);

        endif;

    endif;

 

    // If you cut and paste this sample script into a project

    // and run it, the following line aborts execution of the script.

    abort;

end;