IApplicationAssociationRegistration::SetAppAsDefault method (shobjidl_core.h)

Sets an application as the default for a given extension or protocol, provided that the application's publisher matches the current default's. For more information, see Default Programs. Not intended for use in Windows 8.

Syntax

HRESULT SetAppAsDefault(
       LPCWSTR         pszAppRegistryName,
       LPCWSTR         pszSet,
  [in] ASSOCIATIONTYPE atSetType
);

Parameters

pszAppRegistryName

pszSet

[in] atSetType

Type: ASSOCIATIONTYPE

One of the ASSOCIATIONTYPE enumeration values that specifies the type of the application named in extOrUriScheme, such as file name extension or MIME type.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. In particular, if the application's publisher doesn't match the default's, this method returns E_ACCESSDENIED.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header shobjidl_core.h (include Shobjidl.h)

See also

Default Programs

IApplicationAssociationRegistration