Share via


Méthode ShellUIHelper.AddDesktopComponent

Ajoute un élément à Microsoft Active Desktop.

Syntaxe

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

Paramètres

sURL [in]

Type : BSTR

Valeur string qui spécifie l’URL du nouvel élément favori.

sType [in]

Type : BSTR

Valeur string qui spécifie le type d’élément ajouté. Il peut s’agir de l’une des valeurs suivantes.

(image)

Le composant est une image.

(site web)

Le composant est un site web.

Gauche [in, facultatif]

Type : Variant

Position du bord gauche du composant, en coordonnées d’écran.

Haut [in, facultatif]

Type : Variant

Position du bord supérieur du composant, en coordonnées d’écran.

Width [in, facultatif]

Type : Variant

Largeur du composant, en unités d’écran.

Hauteur [in, facultatif]

Type : Variant

Hauteur du composant, en unités d’écran.

Exemples

L’exemple suivant montre l’utilisation appropriée de cette méthode pour JScript incorporé dans HTML et 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

Spécifications

Condition requise Valeur
Client minimal pris en charge
Windows 2000 Professionnel, Windows XP [applications de bureau uniquement]
Serveur minimal pris en charge
Windows 2000 Server [applications de bureau uniquement]
En-tête
Exdisp.h
DLL
Shell32.dll (version 4.71 ou ultérieure)