AssocGetPerceivedType function
Retrieves a file's perceived type based on its extension.
Syntax
HRESULT AssocGetPerceivedType( _In_ PCWSTR pszExt, _Out_ PERCEIVED *ptype, _Out_ PERCEIVEDFLAG *pflag, _Out_opt_ PWSTR *ppszType );
Parameters
- pszExt [in]
-
Type: PCWSTR
A pointer to a buffer that contains the file's extension. This should include the leading period, for example ".txt".
- ptype [out]
-
Type: PERCEIVED*
A pointer to a PERCEIVED value that indicates the perceived type.
- pflag [out]
-
Type: PERCEIVEDFLAG*
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.
- ppszType [out, optional]
-
Type: PWSTR*
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.
Return value
Type: HRESULT
If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
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.
Requirements
|
Minimum supported client |
Windows XP with SP2 [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|