AssocClientElement

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

CLSID_AssocClientElement {3C81E7FA-1F3B-464A-A350-114A25BEB2A2}

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

Initialisation String

The element is initialised by passing a string to the SetString method. This initialisation string is expected to be the case-insensitive name a type of client application, such as StartMenuInternet for web browsers, Mail for e-mail readers and Media for media players. There may be installed more than one application of each type. One is distinguished as the default of its type. It is found from the following registry keys (in decreasing order of precedence):

Key: HKEY_CURRENT_USER\Software\Clients\ClientTypeName
HKEY_LOCAL_MACHINE\Software\Clients\ClientTypeName
Value: default
Type: REG_SZ

Provided that the REG_SZ data is non-empty (and does not exceed 80 characters), it names the default client of the given type. Except in one case (discussed below), the query source for the client element is then the following registry key:

Key: HKEY_LOCAL_MACHINE\Software\Clients\ClientTypeName\DefaultClient

Note that the per-user specification of the default client is preferred, but if any error prevents the per-user key from becoming the query source, then the machine-wide default client is used instead.

Netscape Mail

Microsoft has gone to some trouble to accommodate a particular third-party client application in which at least some versions, presumably old by now, may have defective association settings in the query source. The software in question is a Mail client named Netscape Messenger. If there is no default value for

Key: HKEY_LOCAL_MACHINE\Software\Clients\Mail\Netscape Messenger\shell\open\command

then the element uses a new query source from the per-user branch:

Key: HKEY_CURRENT_USER\Software\Clients\Mail\Netscape Messenger

If this key does not already exist, then it gets populated with volatile additions from the corresponding machine-wide key. If the key cannot be made acceptable as a query source, it is deleted. There are three additions. First, the default value of the Protocols\mailto\DefaultIcon subkey is transferred, but with an edit. The original value is a path and icon index in a standard notation. The icon index is changed to -1349 for the new value. Second, the default value of the key itself is transferred. Finally, the missing default value for the shell\open\command subkey is constructed from the default value of Protocols\mailto\shell\open\command. The original value is a command line, e.g., a path to an executable followed by command-line arguments. The new value is the path plus -mail.

On noting that the software is the open-source e-mail reader Thunderbird, I can’t help but wonder what the source code says about this helping hand from Microsoft.