This topic has not yet been rated - Rate this topic

AssocQueryKey function

Applies to: desktop apps only

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.

File name extension

A file name extension, such as .txt.

CLSID

A CLSID GUID in the standard "{GUID}" format.

ProgID

An application's ProgID, such as Word.Document.8.

Executable name

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

Minimum supported server

Windows 2000 Server

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 5.0 or later)

Unicode and ANSI names

AssocQueryKeyW (Unicode) and AssocQueryKeyA (ANSI)

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ