RegisterMediaTypeClass function

Registers a mapping of media types to CLSIDs to override the default mapping specified in the registry.


HRESULT RegisterMediaTypeClass(
  _In_       LPBC   pbc,
  _In_       UINT   ctypes,
  _In_       LPCSTR *rgszTypes,
  _In_       CLSID  *rgclsID,
  _Reserved_ DWORD  dwReserved


  • pbc [in]
    A pointer to the IBindCtx interface for the bind context on which the media types are registered.

  • ctypes [in]
    An unsigned integer value that contains the number of media type strings in the rgszTypes array. This parameter cannot be zero.

  • rgszTypes [in]
    A pointer to an array of strings that identify the media types to register. None of these strings can be NULL. See Clipboard Formats for a list of valid values.

  • rgclsID [in]
    A pointer to an array of CLSIDs to associate with the media type strings in the rgszTypes array.

  • dwReserved [in]
    Reserved. Must be set to 0.

Return value

Returns S_OK if successful, or E_INVALIDARG if one or more parameters is invalid.


The new mapping is used in calls to IMoniker::BindToObject when binding objects on the specified bind context.

This function is used by moniker clients calling IMoniker::BindToObject to override the default registry mapping between MIME types and CLSIDs. Typically, the default mapping provided in the registry is used. However, a browser might require the CLSID for its HTML viewer to be associated with .txt files, without changing the default registry association for text files. The override is used for all bind operations using the specified bind context.


Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server


Internet Explorer 3.0







See also