Méthode ShellUIHelper. AddDesktopComponent

Ajoute un élément à Microsoft Active Desktop.

Syntaxe

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

Paramètres

surl [ dans]

Type : BSTR

Valeur de chaîne qui spécifie l’URL du nouvel élément favori.

sSpécification [ dans]

Type : BSTR

Valeur de chaîne 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.

hameçonnage

Le composant est un site Web.

À gauche [ dans, facultatif]

Type : variante

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

En haut [ dans, facultatif]

Type : variante

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

Largeur [ dans, facultatif]

Type : variante

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

Hauteur [ dans, facultatif]

Type : variante

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

Exemples

l’exemple suivant illustre l’utilisation correcte de cette méthode pour JScript incorporée en 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 Professional, Windows XP [ desktop apps 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)