CtrlGetUrlForLinkClicked Example

InstallShield 2016 » InstallScript Language Reference

Project • This information applies to the following project types:

InstallScript
InstallScript MSI

//---------------------------------------------------------------------------

//

//  InstallShield Example Script

//

//  Demonstrates how to use an HTML control with the

//  CtrlGetUrlForLinkClicked and CtrlSetText functions

//

//  To use this sample script:

//  1. Add a custom dialog to your project.

//  2. Add a static text control to the dialog.

//

//---------------------------------------------------------------------------

 

 

#define MY_HYPERLINK1 1401

 

function MyCustomDialog(szTitle, szMsg)

    STRING  szDlg, szTemp, szUrl;

    NUMBER  nId, nMessage, nTemp, nSdDialog;

    HWND    hwndDlg;

    BOOL    bDone;

 

begin

 

    // Specify a name to identify the custom dialog in this installation.

    szDlg = "CustomName";

 

    while (!bDone)

 

        nId = WaitOnDialog( szDlg );

 

        switch(nId)

        case DLG_INIT:

            // Initialize the back, next, and cancel button enable/disable states

            // for this dialog and replace %P, %VS, %VI with

            // IFX_PRODUCT_DISPLAY_NAME, IFX_PRODUCT_DISPLAY_VERSION, and

            // IFX_INSTALLED_DISPLAY_VERSION, respectively, on control IDs 700-724 and 202.

            hwndDlg = CmdGetHwndDlg(szDlg);

            SdGeneralInit(szDlg, hwndDlg, 0, "");

 

            // Put the corresponding Info in the List Field

            if( szMsg != "" ) then

                SdSetStatic(szDlg, SD_STA_MSG, szMsg);

            endif;

 

            SdSetDlgTitle(szDlg, hwndDlg, szTitle);

 

            CtrlSetText(szDlg, MY_HYPERLINK1,

                "[html]<style type=\"text/css\">html,body {padding:0; margin:0;} *

                {font-size: 8pt; font-family: \"MS Sans Serif\";}</style>

                <a href=\"http://www.MyWebSite.com\">

                Visit my Web site</a>");

 

        case MY_HYPERLINK1:

            CtrlGetUrlForLinkClicked(szDlg, MY_HYPERLINK1, szUrl);

            MessageBox("Hyperlink clicked: " + szUrl, 0);

 

            // TO DO: Add additional case statements as needed.

 

        default:

            // check standard handling

            if (SdIsStdButton( nId ) && SdDoStdButton( nId )) then

                bDone = TRUE;

            endif;

        endswitch;

 

    endwhile;

end;

See Also