GetFolderNameList Example

InstallShield 2020 ยป 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 GetFolderNameList function.

*

* GetFolderNameList is called to retrieve all of the folders

* and program items on the desktop.

*

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

 

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

#include "Ifx.h"

 

export prototype ExFn_GetFolderNameList(HWND);

 

function ExFn_GetFolderNameList(hMSI)

    NUMBER  nResult;

    LIST    listItemsID, listFoldersID;

begin

 

    // Create lists for folders and program names.

    listItemsID = ListCreate (STRINGLIST);

    listFoldersID = ListCreate (STRINGLIST);

 

    if (listItemsID = LIST_NULL) || (listFoldersID = LIST_NULL) then

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

    else

        // Display a message box while building the list.

        SdShowMsg ("Searching . . . please wait.", TRUE);

 

        // Place the folder and program names into the lists.

        nResult = GetFolderNameList (FOLDER_DESKTOP, listItemsID, listFoldersID);

 

        // Close the message box.

        SdShowMsg ("", FALSE);

 

        if (nResult < 0) then

            MessageBox ("Unable to retrieve desktop folder and program names.",

                       SEVERE);

        else

        

            // Display the lists.

            repeat

 

                // Disable the Back button.

                Disable (BACKBUTTON);

                

                // Display the list of items.

                nResult = SdShowInfoList ("", "Items list:", listItemsID);

                

                // Enable the Back button.

                Enable (BACKBUTTON);

                

                // Display the list of folders.

                nResult = SdShowInfoList ("", "Folders list:", listFoldersID);

 

            until (nResult = NEXT);

 

        endif;

    endif;

 

end;