IActiveDesktop::AddUrl method (shlobj_core.h)

Adds the desktop item associated with the specified URL.

Syntax

HRESULT AddUrl(
  [in, optional] HWND        hwnd,
  [in]           PCWSTR      pszSource,
  [in]           LPCOMPONENT pcomp,
                 DWORD       dwFlags
);

Parameters

[in, optional] hwnd

Type: HWND

A handle to the parent window for the user interface.

[in] pszSource

Type: PCWSTR

A pointer to a string that contains the URL of the desktop item.

[in] pcomp

Type: LPCOMPONENT

A pointer to the COMPONENT structure that contains the details of the desktop item to be added.

dwFlags

Type: DWORD

An unsigned long integer value that controls this method. Can be set to ADDURL_SILENT to add a desktop item without displaying any user interfaces.

Return value

Type: HRESULT

Returns one of the following values.

Return code Description
E_FAIL
Failed to add the desktop item or an instance of the desktop item already exists on the Active Desktop.
E_INVAILDARG
One or more of the parameters were invalid.
S_OK
If the ADDURL_SILENT flag has been set, the desktop item has either been added successfully or it already exists on the Active Desktop. Otherwise, the desktop item has been added successfully.

Remarks

By default, this method will display some user interface and then add the desktop item to the Active Desktop. Like IActiveDesktop::AddDesktopItem, the client application must call IActiveDesktop::ApplyChanges to have the changes saved to the registry.

Requirements

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

See also

IActiveDesktop

Using the Active Desktop Object