AssocQueryKey function
Searches for and retrieves a key related to a file or protocol association from the registry.
Syntax
HRESULT AssocQueryKey( _In_ ASSOCF flags, _In_ ASSOCKEY key, _In_ LPCTSTR pszAssoc, _In_ LPCTSTR pszExtra, _Out_ HKEY *phkeyOut );
Parameters
- flags [in]
-
Type: ASSOCF
The flags that can be used to control the search. It can be any combination of ASSOCF values, except that only one ASSOCF_INIT value can be included.
- key [in]
-
Type: ASSOCKEY
The ASSOCKEY value that specifies the type of key that is to be returned.
- pszAssoc [in]
-
Type: LPCTSTR
A pointer to a null-terminated string that is used to determine the root key. Four types of strings can be used.
-
A file name extension, such as .txt.
-
A CLSID GUID in the standard "{GUID}" format.
-
An application's ProgID, such as Word.Document.8.
-
The name of an application's .exe file. The ASSOCF_OPEN_BYEXENAME flag must be set in flags.
- pszExtra [in]
-
Type: LPCTSTR
A pointer to an optional null-terminated string with additional information about the location of the string. It is normally set to a Shell verb such as open. Set this parameter to NULL if it is not used.
- phkeyOut [out]
-
Type: HKEY*
A pointer to the key's HKEY value.
Return value
Type: HRESULT
Returns S_OK if successful, or a COM error value otherwise.
Remarks
This function is a wrapper for the IQueryAssociations interface. It is intended to simplify the process of using the interface. For further discussion of how the file and protocol association functions work, see IQueryAssociations.
Requirements
|
Minimum supported client |
Windows 2000 Professional, Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
AssocQueryKeyW (Unicode) and AssocQueryKeyA (ANSI) |