AddUrlToFavorites function

Adds a favorite. Use for backward compatibility only.

Syntax

STDAPI AddUrlToFavorites(
  _In_ HWND    hwnd,
  _In_ LPCWSTR pszUrlW,
  _In_ LPCWSTR pszTitleW,
  _In_ BOOL    fDisplayUI
);

Parameters

  • hwnd [in]
    A handle to the application window.

  • pszUrlW [in]
    A string that specifies the URL of the favorite.

  • pszTitleW [in]
    A string that specifies the title of the favorite, or NULL to use the URL.

  • fDisplayUI [in]
    A Boolean that specifies FALSE to display the Add Favorite dialog box, or TRUE otherwise.

Return value

Returns S_OK if successful, or an error value otherwise.

Remarks

If specified, pszTitleW should not contain characters that are reserved for use by the file system, and it should not exceed MAX_PATH in length. If necessary, AddUrlToFavorites will remove path characters and truncate the string. Set pszTitleW to NULL to use a file system friendly version of the unescaped URL.

If fDisplayUI is TRUE and the user cancels the dialog box, the return value is E_FAIL.

This function is for adding favorites as URLs only; it will not subscribe to channels.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

N/A

DLL

Shdocvw.dll

See also

IShellUIHelper::AddFavorite