CURRENT WORK ITEM - PREVIEW ONLY

AssocShellElement

The shell element is the most basic type of assocation element. All others inherit from it. A basic shell element is created by passing the corresponding CLSID to the AssocCreateElement function:

CLSID_AssocShellElement {C461837F-EA59-494A-B7C6-CD040E37185E}

As with all assocation elements, a shell element implements the IAssociationElement, IObjectWithQuerySource and IPersistString2 interfaces. A newly created element is not initialised until a query source has been specified, either directly through the SetSource method or indirectly through the SetString method.

Initialisation String

If the query source is set indirectly, the initialisation string names a registry path relative to HKEY_CLASSES_ROOT, so that the query source is built on the following registry key:

Key: HKEY_CLASSES_ROOT\InitString

in which InitString is whatever is passed to the SetString method.

Most association elements that inherit from the shell element build their query source from some other registry key, typically but not necessarily depending on the initialisation string. For all shell elements, if the key for the query source cannot be opened (for read access), then SetString fails, the element remains uninitialised, and all the IAssociationElement methods will fail.

Verbs

The query source for a shell element is expected to allow for shell commands. Various queries through the IAssociationElement methods allow for qualification, such that the method’s second argument is a verb, which selects a subkey of the query source:

Key: shell\verb

Default Verb

To provide no verb in the query is to imply use of a default.

The element’s own default verb is the string data from the default value of the shell subkey. If there is no shell\verb subkey, the default verb is the string data up to but not including the first space or comma. If there is no shell\verb subkey for this default verb, then the element is understood as not supporting a default verb such that all queries with no verb must fail.

An element that does not specify its own default verb gets “open” as its default. If there is no shell\open subkey, then the element is in general understood as not supporting a default verb such that all queries with no verb must fail. The exception is only for shell elements that are also ProgID elements. These have one further fallback, to whatever is the first shell\verb subkey.