IApplicationAssociationRegistration::QueryCurrentDefault method (shobjidl_core.h)

Determines the default application for a given association type. This is the default application launched by ShellExecute for that type.

Syntax

HRESULT QueryCurrentDefault(
  [in]  LPCWSTR          pszQuery,
  [in]  ASSOCIATIONTYPE  atQueryType,
  [in]  ASSOCIATIONLEVEL alQueryLevel,
  [out] LPWSTR           *ppszAssociation
);

Parameters

[in] pszQuery

Type: LPCWSTR

A pointer to a null-terminated, Unicode string that contains the file name extension or protocol, such as .mp3 or http.

[in] atQueryType

Type: ASSOCIATIONTYPE

One of the ASSOCIATIONTYPE enumeration values that specifies the type of association, such as extension or MIME type.

[in] alQueryLevel

Type: ASSOCIATIONLEVEL

One of the ASSOCIATIONLEVEL enumeration values that specifies the level of association, such as per-user or machine. This is typically AL_EFFECTIVE.

[out] ppszAssociation

Type: LPWSTR*

When this method returns, contains the address of a pointer to the ProgID that identifies the current default association.

Note  It is the responsibility of the calling application to release the string through CoTaskMemFree.
 

Return value

Type: HRESULT

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

Remarks

The string produced is typically a ProgID matching one of the ProgIDs associated with a registered application, but there are a few exceptions: If the string returned is a machine default protocol, it is a legacy string indicating a command line to a .exe handler instead of a ProgID. Similarly, if returning a machine default MIME type, it returns a legacy class identifier (CLSID) string instead of a ProgID.

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