SprintfBox Example

InstallShield 2016 » InstallScript Language Reference

Project • This information applies to the following project types:

Basic MSI
InstallScript
InstallScript MSI

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

*

* This script gets the capacity of drive C: and then calls

* SprintfBox to create and display a formatted message.  That

* message includes the drive letter and disk size, which are

* stored in variables.

*

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

 

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

#include "Ifx.h"

 

export prototype ExFn_SprintfBox(HWND);

 

function ExFn_SprintfBox(hMSI)

    STRING  svResult;

    NUMBER  nvResult;

begin

 

    // Set up the string parameter for the call to GetSystemInfo.

    svResult = "C:";

 

    // Get the capacity of drive C.

    GetSystemInfo (DISK_TOTALSPACE, nvResult, svResult);

 

    // Build and display a message that incorporates

    // the values returned by GetSystemInfo.

    SprintfBox (INFORMATION, "System Information",

               "Total disk space on drive %s is %ld bytes.",

               svResult, nvResult);

 

end;