SetDefault method

Deprecated. Sets the default Accelerator or search provider.

Note As of Microsoft Edge, this method is deprecated.


HRESULT retVal = object.SetDefault(fDefault, hwnd);


  • fDefault [in]
    Type: BOOL

    TRUE to set the provider as the default for its category; FALSE to remove the default.

  • hwnd [in]
    Type: HWND

    The window handle to use for the confirmation and error dialogs, or NULL to specify no window handle.

Return value


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


The IOpenService::SetDefault method can be used to set both a default Accelerator for a category or the default search provider.

Setting a default provider for a category will displace the current default in that category. If you set the fDefault parameter to FALSE to remove the default Accelerator, the category will have no default.

Setting a new default search provider causes Windows Internet Explorer to display a confirmation dialog box. If a user clicks the Cancel button on the dialog, the method returns OS_E_CANCELLED. Note that you cannot remove the default search provider, because it is required by the Search Box. This method returns OS_E_NOTSUPPORTED if you attempt to do so.

See also