IApplicationAssociationRegistration::QueryCurrentDefault method

Determines the default application for a given association type. This is the default application launched by ShellExecute for that type. Not intended for use in Windows 8.

Syntax


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

Parameters

pszQuery [in]

Type: LPCWSTR

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

atQueryType [in]

Type: ASSOCIATIONTYPE

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

alQueryLevel [in]

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.

ppszAssociation [out]

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

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Shobjidl.h

IDL

Shobjidl.idl

See also

IApplicationAssociationRegistration
Default Programs

 

 

Community Additions

ADD
Show:
© 2014 Microsoft