GetDisk 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 GetDisk function.

*

* This script gets a fully qualified directory name from

* the user.  Next, it calls GetDisk to return the disk drive

* designation. The drive designation is then displayed.

*

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

 

#define TITLE_TEXT "GetDisk example"

 

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

#include "Ifx.h"

 

export prototype ExFn_GetDisk(HWND);

 

function ExFn_GetDisk(hMSI)

    STRING svSelectedDir, svDisk;

begin

 

   // Get a fully qualified directory name from the user.

    AskPath ("Select a directory.", INSTALLDIR, svSelectedDir);

 

    // Get the drive designation from the selected directory name.

    if (GetDisk (svSelectedDir, svDisk) < 0) then

        // Report the error.

        MessageBox ("GetDir failed.", SEVERE);

    else

        // Display the drive designation as it was returned by GetDisk.

        SprintfBox (INFORMATION, TITLE_TEXT, "Disk drive: %s", svDisk);

    endif;

 

end;