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

CLSID_AssocApplicationElement {0C2BF91B-8746-4FB1-B4D7-7C03F890B168}

As with all assocation elements, the application element implements the IAssociationElement, IObjectWithQuerySource and IPersistString2 interfaces.

Initialisation String

The element is initialised by passing a string to the SetString method. This initialisation string is expected to be the path to an application. The filename component of this path determines the registry key that is used as the query source:

Key: HKEY_CLASSES_ROOT\Applications\filename

If the filename has no file extension, “.exe” is appended for the subkey.

If this key cannot be opened (for read access), then SetString ordinarily fails. However, if the given path was not just the filename and a file actually does exist at the given path, then SetString returns S_FALSE rather than an error.