Microsoft Windows CE 3.0  

GetClassFile

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function supplies the class identifier associated with the specified file name.

WINOLEAPI GetClassFile (
LPCWSTR
szFileName
,
CLSID *
pclsid
);

Parameters

szFileName
[in] Null-terminated string that contains the file name for which you are requesting the associated class identifier.
pclsid
[out] Pointer to the location where the associated class identifier is written on return.

Return Values

One of the values described in the following table is returned.

Value Description
S_OK Indicates the class identifier was successfully supplied.
MK_E_CANTOPENFILE Indicates unable to open the specified filename.
MK_E_INVALIDEXTENSION Indicates the specified extension in the registry is invalid.

This function can also return any file system errors.

Remarks

When given a filename, the GetClassFilefunction finds the class identifier associated with that file. Examples of its use are in OleCreateFromFile, which is passed a file name and requires an associated class identifier, and in the OLE implementation of IMoniker::BindToObject, which, when a link to a file-based document is activated, calls GetClassFileto locate the object application that can open the file.

The GetClassFilefunction searches for the File Extension key in the registry that corresponds to the . extportion of the filename. If the database entry contains a valid class identifier, this function returns that class identifier.

If the File Extension key is not found or the database entry contains an invalid class identifier, the function returns MK_E_INVALIDEXTENSION.

Requirements

Runs On Versions Defined in Include Link to
Windows CE OS 2.10 and later Objbase.h    
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

IMoniker::BindToObject, StringFromCLSID, WriteClassStg