SHGetAssocKeys

This function obtains handles to the registry keys that support an association array.

Declaration

UINT 
SHGetAssocKeys (
    IUnknown *punkAssociationInfo,
    HKEY *aKeys,
    UINT cKeys);

Parameters

The punkAssociationInfo argument is the address of a COM object that has an association list.

The aKeys argument provides the address of an array of variables which are each to receive a key handle.

The cKeys argument tells how many key handles the array can hold.

Return Value

The function returns the number of registry keys it has stored in the array. To return zero is to fail.

Behaviour

The given object must implement an IObjectWithAssociationList interface, else the function fails. The typical, if not the defining, example is a QueryAssociations object such as created by the AssocCreateForClasses function.

If the object has no association list (with an IAssociationList interface) or the list has no enumerator (with an IEnumerateAssociationElements interface), then the function fails. For each successive association element that has a registry key, the function stores the registry key in successive variables in the given array. The registry keys are opened for KEY_READ access only. The function returns the number of keys obtained.

For an association element (with an IAssociationElement interface) to have a registry key, it must implement the IObjectWithQuerySource interface and the query source obtained through this interface must in turn implement the IObjectWithRegistryKey interface and actually report that it has a registry key.

Availability

The SHGetAssocKeys function is exported from SHELL32.DLL as ordinal 777 in the version 6.00 from Windows Vista, and higher.

This function was not documented by Microsoft for the January 2007 edition of the Windows Vista Software Development Kit (SDK).

As an aside, note that all six interfaces involved in handling this function are also undocumented.