ListValid Example

InstallShield 2024 » InstallScript Language Reference

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

*

* InstallShield Example Script

*

* Demonstrates the ListValid function.

*

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

 

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

#include "Ifx.h"

 

function OnBegin()

    LIST listID;

    number nListValid;

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;

 

    // Check whether the list ID is valid.

    nListValid = ListValid (listID);

    if (nListValid >= ISERR_SUCCESS) then

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

    else

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

    endif;

 

   // Remove the list from memory.

    ListDestroy (listID);

 

    // Check whether the list ID is valid.

    nListValid = ListValid (listID);

    if (nListValid >= ISERR_SUCCESS) then

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

    else

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

    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;