AssocGetPerceivedType function (shlwapi.h)
Retrieves a file's perceived type based on its extension.
LWSTDAPI AssocGetPerceivedType( [in] PCWSTR pszExt, [out] PERCEIVED *ptype, [out] PERCEIVEDFLAG *pflag, [out, optional] PWSTR *ppszType );
A pointer to a buffer that contains the file's extension. This should include the leading period, for example ".txt".
A pointer to a PERCEIVED value that indicates the perceived type.
A pointer to a value that indicates the source of the perceived type information. One or more of the following values.
No perceived type was found (PERCEIVED_TYPE_UNSPECIFIED).
The perceived type was determined through an association in the registry.
The perceived type is inherently known to Windows.
The perceived type was determined through a codec provided with Windows.
The perceived type is supported by the GDI+ library.
The perceived type is supported by the Windows Media SDK.
The perceived type is supported by Windows compressed folders.
[out, optional] ppszType
If the function returns a success code, this contains the address of a pointer to a buffer that receives the perceived type string, for instance "text" or "video". This value can be NULL.
If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
This function first compares the extension against a hard-coded set of extensions known to Windows. If that search fails to reveal a match, the registered associations under HKEY_CLASSES_ROOT are searched for a key that matches the extension and contains a PerceivedType value. If that value is found, the extension set is again searched for a match. If again no match is found, the perceived type is determined to be PERCEIVED_TYPE_CUSTOM. If either a key that matches the extension or a PerceivedType value is not found, the perceived type is reported as PERCEIVED_TYPE_UNSPECIFIED.
|Minimum supported client||Windows XP with SP2 [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|
|DLL||Shlwapi.dll (version 6.0 or later)|