Windows Mobile 6.5
A version of this page is also available for

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

WINOLEAPI GetClassFile( 
  LPCWSTR szFileName, 
  CLSID* pclsid


[in] Null-terminated string that contains the file name for which you are requesting the associated class identifier.


[out] Pointer to the location where the associated class identifier is written on return.

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

Value Description


Indicates the class identifier was successfully supplied.


Indicates unable to open the specified file name.


Indicates the specified extension in the registry is invalid.

This function can also return any file system errors.

When given a file name, the GetClassFile function finds the class identifier associated with that file. An example of its use is in the OLE implementation of IMoniker::BindToObject. This calls GetClassFile to locate the object application that can open the file when a link to a file-based document is activated.

The GetClassFile function searches for the File Extension key in the registry that corresponds to the .ext portion of the file name. 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.

To determine whether the platform supports this function, see Determining Supported COM APIs.

Windows Embedded CEWindows CE 2.10 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions