IQueryAssociations interface (shlwapi.h)

Exposes methods that simplify the process of retrieving information stored in the registry in association with defining a file type or protocol and associating it with an application.


The IQueryAssociations interface inherits from the IUnknown interface. IQueryAssociations also has these types of members:


The IQueryAssociations interface has these methods.


Searches for and retrieves file or protocol association-related binary data from the registry.

This method is not implemented. (IQueryAssociations.GetEnum)

Searches for and retrieves a file or protocol association-related key from the registry.

Searches for and retrieves a file or protocol association-related string from the registry. (IQueryAssociations.GetString)

Initializes the IQueryAssociations interface and sets the root key to the appropriate ProgID.


When to Implement

This interface is exposed by the Shell or by namespace extensions to simplify handling file and protocol associations. You should not implement this interface.

When to Use

Use this interface if you need information from the registry related to file or protocol associations. For example, you can use this interface to retrieve information associated with a file name extension such as the command string of one of its verbs.

A complete registry path or HKEY value is not required. Instead, you can retrieve information based on criteria such as the file name extension or executable name. For a discussion of file associations, see File Types.

You can also retrieve an application's name using this interface. Use method IQueryAssociations::GetString. Set the str parameter to ASSOCSTR_FRIENDLYAPPNAME.

To use this interface, you must first retrieve a pointer to it. Typically, you retrieve an QueryInterface pointer by calling a Shell object's IShellFolder::GetUIObjectOf method. You can also retrieve an interface pointer by calling AssocCreate (set clsid to CLSID_QueryAssociations). Initialize the interface with IQueryAssociations::Init. This method sets the root key that will be used when you call any of the remaining three methods to retrieve information from the registry. They will look only below the root key. You must release the interface when you no longer need it.

The IQueryAssociations interface is useful if you need to repeatedly query the registry for information. Once the interface is initialized, the overhead of calling the various methods is relatively small. There are also several related functions, listed in the See Also section, that allow you to retrieve the same information from the registry with a single function call. While they are simpler to use, they cause the overhead of creating and initializing IQueryAssociations each time they are called. Because of this, they are best suited for single use.


Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h

See also