Determines the default application for a given association type. This is the default application launched by ShellExecute for that type.
Syntax
HRESULT QueryCurrentDefault(
LPCWSTR pszQuery,
ASSOCIATIONTYPE atQueryType,
ASSOCIATIONLEVEL alQueryLevel,
LPWSTR *ppszAssociation
);
Parameters
- pszQuery
-
[in] A pointer to a null-terminated, Unicode string that contains the file extension or protocol, such as .mp3 or http.
- atQueryType
-
[in] One of the ASSOCIATIONTYPE enumeration values that specifies the type of association, such as extension or MIME type.
- alQueryLevel
-
[in] 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] 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
Returns S_OK if successful, or an error value otherwise.
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.
See Also
Default Programs