Share via


GetClassFile (Compact 2013)

3/26/2014

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

Syntax

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 Value

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 file name.

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 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.

Requirements

Header

objbase.h

Library

ole32.lib

See Also

Reference

COM Functions
IMoniker::BindToObject
StringFromCLSID
WriteClassStg