LongPathToQuote Example

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


* This script calls LongPathToQuote to place double quotation

* marks around a long file name.  The result is displayed in

* in a dialog.  Then, LongPathToQuote is called again to

* remove the quotation marks and the result displayed in a

* dialog.




// Define a constant for the base path (a long file name).

#define BASE_PATH "C:\\Program Files"


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

#include "Ifx.h"


export prototype ExFn_LongPathToQuote(HWND);


function ExFn_LongPathToQuote(hMSI)

    STRING  svPath, szMainDirectory, szMsg;



    // Set up parameter for call to LongPathToQuote.

    svPath = BASE_PATH;


    // Place double quotation marks around the long file name in svPath.

    if (LongPathToQuote (svPath, TRUE) < 0) then

        MessageBox ("First call to LongPathToQuote failed.", SEVERE);




    // Display the quoted long file name in svPath.

    szMsg = "The quoted long file name:\n\n" + svPath;

    MessageBox (szMsg, INFORMATION);


    // Remove the quotation marks from the long file name in svPath.

    if (LongPathToQuote (svPath, FALSE) < 0) then

        MessageBox ("Second call to LongPathToQuote failed.", SEVERE);




    // Display the long file name with quotation marks removed.

    szMsg = "The unquoted long file name is shown below: \n\n" + svPath;


    MessageBox (szMsg, INFORMATION);