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

*

* This example sets a Shell property for a shortcut. The

* property hides the context menu commands that enable

* end users to pin the shortcut to the taskbar and to the

* Start menu.

*

* Note: In order for this script to run correctly, add an

* executable file to your project, and in the Shortcuts view,

* create a shortcut called My Shortcut. The target of the

* shortcut should be the executable file that you added to

* your project. The location of the shortcut should be the

* desktop.

*

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

 

function OnFirstUIAfter()

    STRING szName, szValue;

begin

 

    // Set up parameters for the SetShortcutProperty call.

    szName  = "My Shortcut";

    szValue = "1";

 

    // Set the shortcut property that prevents pinning to the taskbar and the Start menu.

    if (SetShortcutProperty (FOLDER_DESKTOP, szName, SSP_PROPERTY_PREVENT_PINNING,

                             szValue) < 0) then

        MessageBox ("SetShortcutProperty failed", SEVERE);

    else

        SprintfBox (INFORMATION, "SetShortcutProperty", "%s configured successfully.",

                   szName);

    endif;

 

end;