SelectFolder Example

InstallShield 2019 » InstallScript Language Reference

Project • This information applies to the following project types:

InstallScript
InstallScript MSI

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

*

* InstallShield Example Script

*

* Demonstrates the SelectFolder function.

*

* First, SelectFolder is called to get a folder selection from

* the user.  Then the name of the selected folder is displayed.

*

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

 

#define TITLE_TEXT "SelectFolder Example"

 

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

#include "Ifx.h"

 

export prototype ExFn_SelectFolder(HWND);

 

function ExFn_SelectFolder(hMSI)

   STRING svResultFolder;

    NUMBER nReturn;

begin

 

   // Get folder selection from user. Make "Startup" the

   // default selection

   nReturn = SelectFolder (TITLE_TEXT, "Startup", svResultFolder);

 

   if (nReturn < 0) then

 

      // Report an error.

      MessageBox ("SelectFolder failed.", SEVERE);

 

   else

 

      // Display the name of the selected folder.

      SprintfBox (INFORMATION, TITLE_TEXT,

                  "Selected folder: %s", svResultFolder);

 

   endif;

 

end;