InstallShield 2016 » 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 ListSetIndex function.
*
* This example script displays the last three items from a list
* of program folders.
*
* Note: If the target system has a shell other than Explorer,
* the GetGroupNameList function may return an error.
*
\*--------------------------------------------------------------*/
#define TITLE_TEXT "ListSetIndex Example"
#define MSG_TEXT "Please note the last three items in this list."
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_ListSetIndex(HWND);
function ExFn_ListSetIndex(hMSI)
STRING svString;
LIST listID;
NUMBER nResult, nIndex;
begin
// Create 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.
if GetGroupNameList (listID) < 0 then ;
// Report ListCreate failure.
MessageBox ("Unable to retrieve program folder names.", SEVERE);
else
// Display the list.
SdShowInfoList( TITLE_TEXT, MSG_TEXT, listID);
// Make the third item from the end of the list the current
// the current element. If there are fewer than three items,
// display them all. List indexing begins at 0.
nIndex = ListCount (listID);
if nIndex > 3 then
nIndex = nIndex - 3;
endif;
nResult = ListSetIndex (listID, nIndex);
// Loop while there are items to display.
while (nResult != END_OF_LIST)
// Get the current list item.
ListCurrentString (listID, svString);
// Display the current list item.
MessageBox (svString, INFORMATION);
// Make the next item the current item.
nResult = ListSetIndex (listID, LISTNEXT);
endwhile;
endif;
// Remove the list from memory.
ListDestroy (listID);
end;
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |