Bagikan melalui


Metode ShellUIHelper.AddDesktopComponent

Menambahkan item ke Microsoft Active Desktop.

Sintaks

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

Parameter

sURL [in]

Jenis: BSTR

Nilai String yang menentukan URL item favorit baru.

sType [in]

Jenis: BSTR

Nilai String yang menentukan jenis item yang ditambahkan. Ini bisa menjadi salah satu nilai berikut.

(gambar)

Komponen adalah gambar.

(situs web)

Komponennya adalah situs web.

Kiri [masuk, opsional]

Jenis: Varian

Posisi tepi kiri komponen, dalam koordinat layar.

Atas [in, opsional]

Jenis: Varian

Posisi tepi atas komponen, dalam koordinat layar.

Lebar [dalam, opsional]

Jenis: Varian

Lebar komponen, dalam unit layar.

Tinggi [masuk, opsional]

Jenis: Varian

Tinggi komponen, dalam unit layar.

Contoh

Contoh berikut menunjukkan penggunaan metode ini yang tepat untuk JScript yang disematkan dalam HTML dan 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

Persyaratan

Persyaratan Nilai
Klien minimum yang didukung
Windows 2000 Professional, Windows XP [hanya aplikasi desktop]
Server minimum yang didukung
Windows 2000 Server [hanya aplikasi desktop]
Header
Exdisp.h
DLL
Shell32.dll (versi 4.71 atau yang lebih baru)