IHomePageSetting::SetHomePage method

Deprecated. Requests permission to change the user's home page.

Note  As of Microsoft Edge, this method is deprecated.

 

 

Syntax

HRESULT SetHomePage(
  [in] HWND    hwnd,
  [in] LPCWSTR homePageUri,
  [in] LPCWSTR brandingMessage
);

Parameters

  • hwnd [in]
    Window handle to use for the confirmation dialog box or NULL to specify no handle.

  • homePageUri [in]
    URI for the new home page. Must resolve to a valid URI string.

  • brandingMessage [in]
    The brand associated with the application or the program requesting the change. This is displayed in the confirmation dialog.

    If this parameter value is set to NULL, the domain of the homePageUri parameter is displayed instead.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

When called for selected devices, this method displays a confirmation dialog box that asks the user to confirm the change. If the user denies permission or cancels the dialog, an error is returned and the home page is not changed. For devices that do not require permission, the home page is handled without user involved. Note that the request may still fail for other reasons, such as group policy settings.

Note  As of this writing, the confirmation dialog is displayed only for devices using Chinese as the primary language.

 

Examples

int __cdecl wmain(__in int argc, __in_ecount(argc) WCHAR* argv[])
{
    BOOL fComInitialized = FALSE;
    if (argc != 3 && argc != 2)
    {
        DisplayUsage();
    }
    else if (SUCCEEDED(CoInitialize(NULL)))
    {
        fComInitialized = TRUE;
        CComPtr<IHomePageSetting> spHPSetting;
        HRESULT hr = spHPSetting.CoCreateInstance(CLSID_HomePageSetting);
        if (SUCCEEDED(hr))
        {
            if (argc == 2)
            {
                hr = spHPSetting->SetHomePage(NULL, argv[1], NULL);
            }
            else
            {
                hr = spHPSetting->SetHomePage(NULL, argv[1], argv[2]);
            }
        }
    }
    if (fComInitialized)
    {
        CoUninitialize();
    }
    return 0;
}

Requirements

Minimum supported client

Windows 7

Minimum supported server

Windows Server 2012 R2

Product

IE11

Header

Homepagesetting.h

IDL

Homepagesetting.idl

DLL

Ieframe.dll

See also

IHomePageSetting

IHomePageSetting::IsHomePage

IHomePageSetting::SetHomePageToBrowserDefault