SHGetObjectCompatFlags

This function obtains compatibility flags for a given object.

Declaration

DWORD 
SHGetObjectCompatFlags (
    IUnknown *punk, 
    CLSID const *pclsid);

Parameters

The punk argument is any interface pointer for the object of interest.

The pclsid argument is the address of a CLSID for the object of interest.

Return Value

The function returns the compatibility flags, defaulting to zero. The following flags are defined. Names are reproduced from corresponding registry values (see below).

Flag Name Supported Versions
0x00000001 OTNEEDSSFCACHE 5.50 and higher
0x00000002 NO_WEBVIEW 5.50 and higher
0x00000004 UNBINDABLE 5.50 and higher
0x00000008 PINDLL 5.50 and higher
0x00000010 NEEDSFILESYSANCESTOR 5.50 and higher
0x00000020 NOTAFILESYSTEM 5.50 and higher
0x00000040 CTXMENU_NOVERBS 5.50 and higher
0x00000080 CTXMENU_LIMITEDQI 5.50 and higher
0x00000100 COCREATESHELLFOLDERONLY 5.50 and higher
0x00000200 NEEDSSTORAGEANCESTOR 6.00 and higher
0x00000400 NOLEGACYWEBVIEW 6.00 and higher
0x00001000 CTXMENU_XPQCMFLAGS 6.00 from Windows Vista, and higher

It is not presently intended that this page will describe what each of these flags is for, just what this function does to report them.

Behaviour

The object may be described either by its CLSID or by an interface pointer. The latter has priority but the object must implement the IPersist or IPersistFolder interface, for its GetClassID method. If punk is not NULL but the function cannot determine the CLSID, then the function defaults. The function also defaults if punk and pclsid are both NULL.

Some objects have hard-coded compatibility flags:

CLSID Compatibilty Flags
{00F43EE0-EB46-11D1-8443-444553540000} NO_WEBVIEW
{2BBBB600-3F0A-11D1-8AEB-00C04FD28D85} PINDLL
OTNEEDSSFCACHE
{49707377-6974-6368-2E4A-756E6F644A01} OTNEEDSSFCACHE
PINDLL (added in version 6.00 and higher)
{49707377-6974-6368-2E4A-756E6F644A0A} UNBINDABLE
{61E285C0-DCF4-11CF-9FF4-444553540000} NOTAFILESYSTEM
{7877C8E0-8B13-11D0-92C2-00AA004B256F} NEEDSFILESYSANCESTOR
{921BD320-8CB5-11CF-84CF-885835D9DC01} PINDLL
{969223C0-26AA-11D0-90EE-444553540000} CTXMENU_LIMITEDQI
{B8777200-D640-11CE-B9AA-444553540000} PINDLL
{CD949A20-BDC8-11CE-8919-00608C39D066} CTXMENU_NOVERBS
{D1069700-932E-11CF-AB59-00608CBF2CE0} NO_WEBVIEW
{E9779583-939D-11CE-8A77-444553540000} OTNEEDSSFCACHE
NO_WEBVIEW

All objects can have compatibility flags set through the registry:

Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ShellCompatibility\Objects\{clsid}

To each flag, there corresponds a registry value, as listed above, in the key for the given CLSID. If the value is readable, whatever its data, then the object has that flag. The function tests for each of the defined values and returns the combination. If the object also has hard-coded compatibility flags, the two sets of flags are combined.

Availability

The SHGetObjectCompatFlags function is exported from SHLWAPI.DLL as ordinal 476 in version 5.50 and higher.

Though this function dates from as long ago as 2000, it was still not documented by Microsoft as late as the January 2007 edition of the Windows Vista Software Development Kit (SDK).