Instances of the CLSID type of assocation element are created by passing the corresponding CLSID to the AssocCreateElement function:

CLSID_AssocClsidElement {57AEA081-5EE9-4C27-B218-C4B702964C54}

As with all assocation elements, the CLSID element implements the IAssociationElement, IObjectWithQuerySource and IPersistString2 interfaces. However, all the methods of a CLSID element are the same as for the basic shell element except for SetString and GetClassID. In effect, a CLSID element is just a shell element with a different query source.

Initialisation String

When a CLSID element is initialised through its SetString method, the registry key that is used as the query source is:


in which InitString is whatever is passed to the SetString method when initialising the element. In typical practice, this initialisation string is a CLSID in the standard notation with curly braces.


In ordinary usage, a CLSID element exists within a QueryAssociations object, also called an association array. One way to get a CLSID element created in an association array is to create the array and then call its Init method without setting the ASSOCF_INIT_BY_EXENAME flag, and providing either a key (in the hkProgid argument) or a string (in the pszAssoc argument) that begins with an opening curly brace. Another way is to call the AssocCreateForClasses function and specify either ASSOCCLASS_CLSID_KEY or ASSOCCLASS_CLSID_STR as the type for one or more association elements.