AssocPerceivedElement

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

CLSID_AssocPerceivedElement {0DC5FB21-B93D-4E3D-BB2F-CE4E36A70601}

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

Perceived elements fall into two broad categories depending on whether they have something called native support. With native support, all the methods of a perceived element are the same as for the basic shell element except for SetString and GetClassID. In effect, a perceived element with native support is just a shell element with a different query source.

Initialisation String

When a perceived element is initialised through its SetString method, the selection of its query source has two very distinct cases to it.

Executable Files

If the initialisation string is the pathname of an executable file, meaning here that the file extension is any of the following

then the query source for the perceived element is a hard-coded simulation of the registry key

Key: HKEY_CLASSES_ROOT\exefile

such that only one value is defined:

Key: HKEY_CLASSES_ROOT\exefile\shell\open\command
Value: default
Type: REG_SZ
Data: "%1" %*

Perceived Types

More generally, the query source is

Key: HKEY_CLASSES_ROOT\SystemFileAssocations\type

where type is the so-called perceived type, as obtained from feeding the initialisation string to the AssocGetPerceivedType function. It is typically one of application, audio, compressed, document, gamemedia, image, system, text or video. A summary of how this type is obtained is that it may be hard-coded because the initialisation string is one of very many recognised file extensions or it may be found from the registry as the data for a value in either of two keys:

Key: HKEY_CLASSES_ROOT\InitString
HKEY_CLASSES_ROOT\SystemFileAssociations\InitString
Value: PerceivedType
Type: REG_SZ or REG_EXPAND_SZ

in which InitString is, of course, the initialisation string. 

No Native Support

Some perceived types have native support. For the SHLWAPI version 6.00 from Windows Vista, native support is reported when audio, compressed, image or video is determined from hard-coded file extensions, or when gamemedia or text is found through the registry.

An element that does not have native support differs from the basic shell element by more than just the registry key that is used for the query source. The GetSource method fails and the IAssociationElement methods support only a handful of queries. Apart from ASSOCQUERY 0x010F0000 and 0x01170001, which are supported by all elements, the only supported queries are 0x00170000 and 0x00070001, for the FriendlyTypeName and DefaultIcon settings respectively.