StrToUpper 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 StrToUpper and StrToLower functions.

*

* StrToUpper is called to convert the characters in szSource

* from lowercase to uppercase.

*

* StrToLower is then called to convert the uppercase

* characters to lowercase.

*

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

 

#define TITLE_TEXT "StrToUpper & StrToLower"

 

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

#include "Ifx.h"

 

export prototype ExFn_StrToUpper(HWND);

 

function ExFn_StrToUpper(hMSI)

    STRING szSource, svTarget, szTitle, szMsg;

    NUMBER nReturn;

begin

 

    // Set up parameter for call to StrToUpper.

    szSource = "aBcDeF";

 

    // Convert all characters to upper case.

    nReturn = StrToUpper (svTarget, szSource);

 

    if (nReturn < 0) then

        MessageBox ("StrToUpper failed.", SEVERE);

    endif;

 

    szMsg = "Original: %s\n\nModified: %s";

 

    // Display the modified string.

    SprintfBox (INFORMATION, szTitle, szMsg, szSource, svTarget);

 

    // Set up parameter for call to StrToLower.

    szSource = "ABC123*&?d";

 

    // Convert all characters to lower case.

    nReturn = StrToLower (svTarget, szSource);

 

    if (nReturn < 0) then

        MessageBox ("StrToLower failed.", SEVERE);

    endif;

 

    // Display the modified string.

    szMsg = "Original:  %s\n\nModified:  %s\n(Note--Non-alphabetic chars " +

            "are not changed)";

    SprintfBox (INFORMATION, TITLE_TEXT, szMsg, szSource, svTarget);

 

end;