ShellUIHelper.AddDesktopComponent method

Adds an item to the Microsoft Active Desktop.

Syntax

iRetVal = ShellUIHelper.AddDesktopComponent(
  sURL,
  sType,
  [ Left ],
  [ Top ],
  [ Width ],
  [ Height ]
)

Parameters

sURL [in]

Type: BSTR

A String value that specifies the URL of the new favorite item.

sType [in]

Type: BSTR

A String value that specifies the type of item being added. This can be one of the following values.

(image)

The component is an image.

(website)

The component is a website.

Left [in, optional]

Type: Variant

The position of the left edge of the component, in screen coordinates.

Top [in, optional]

Type: Variant

The position of the top edge of the component, in screen coordinates.

Width [in, optional]

Type: Variant

The width of the component, in screen units.

Height [in, optional]

Type: Variant

The height of the component, in screen units.

Examples

The following example shows the proper usage of this method for JScript embedded in HTML and Visual Basic.

JScript:

<html>
<head>
<title></title>

<object id="ShellUIHelper"
        classid="CLSID:64AB4BB7-111E-11d1-8F79-00C04FC2FBE1"
        width=0
        height=0
        VIEWASTEXT>
</object>

<script language="JavaScript">
    function fnShellUIHelperAddDesktopComponentJ()
    {
        ShellUIHelper.AddDesktopComponent("https://www.microsoft.com/", "website");
    }
</script>

</head>
<body onload=fnShellUIHelperAddDesktopComponentJ()>
</body>
</html>

Visual Basic:

Private Sub fnShellUIHelperAddDesktopComponentVB()
    Dim objShellUIHelper As ShellUIHelper
    
    Set objShellUIHelper = New ShellUIHelper
        objShellUIHelper.AddDesktopComponent "https://www.microsoft.com/", "website"
    Set objShellUIHelper = Nothing
End Sub

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Exdisp.h
DLL
Shell32.dll (version 4.71 or later)