CoGetClassObjectFromURL function

Returns a factory object for a given CLSID.

Syntax

HRESULT CoGetClassObjectFromURL(
  _In_       REFCLSID  rclsid,
  _In_       LPCWSTR   szCodeURL,
  _In_       DWORD     dwFileVersionMS,
  _In_       DWORD     dwFileVersionLS,
  _In_       LPCWSTR   szContentType,
  _In_       LPBINDCTX pBindCtx,
  _In_       DWORD     dwClsContext,
  _Reserved_ LPVOID    pvReserved,
  _In_       REFIID    riid,
  _Out_      VOID      **ppv
);

Parameters

  • rclsid [in]
    The CLSID of the ActiveX object to install. If the value is CLSID_NULL, szContentType is used to determine the CLSID.

  • szCodeURL [in]
    The address of a string value that contains the full URL of the code for the ActiveX object.

  • dwFileVersionMS [in]
    An unsigned long integer value that contains the major version number for the object to be installed. If this value and the value for dwFileVersionLS are both 0xFFFFFFFF, the latest version of the code should always be installed. This means that Internet Component Download will always attempt to download new code.

  • dwFileVersionLS [in]
    An unsigned long integer value that contains the minor version number for the object to be installed. If this value and the value for dwFileVersionMS are both 0xFFFFFFFF, the latest version of the code should always be installed. This means that Internet Component Download will always attempt to download new code.

  • szContentType [in]
    A pointer to a string value that contains the MIME type to be understood by the installed ActiveX object. If rclsid is CLSID_NULL, this string is used to determine the CLSID of the object to install. Note that this parameter is useful only when you try to download a viewer for a particular media type; when the MIME type of media is known, but the CLSID is not.

  • pBindCtx [in]
    A pointer to the bind context to use for downloading or installing component code. An implementation of IBindStatusCallback must be registered on this bind context before you can call this function.

  • dwClsContext [in]
    An unsigned long integer value that specifies the execution context for the class object. This can be one of the values taken from the CLSCTX enumeration.

  • pvReserved [in]
    Reserved. Must be set to NULL.

  • riid [in]
    The reference identifier of the interface to obtain on the factory object. Usually, this interface is IClassFactory.

  • ppv [out]
    The interface pointer for synchronous calls, or NULL otherwise.

Return value

Returns one of the following values.

Return code Description
S_OK

The operation completed successfully, and the ppv parameter contains the requested interface pointer.

E_NOINTERFACE

The requested interface pointer is not available.

MK_S_ASYNCHRONOUS

Component code will be downloaded and installed asynchronously. The client will receive notifications through the IBindStatusCallback interface registered on pBindCtx.

 

Remarks

If no CLSID is specified (CLSID_NULL), the CoGetClassObjectFromURL function chooses the appropriate CLSID for interpreting the MIME type specified in szContentType. If the specified object is installed on the system, it is instantiated. Otherwise, the necessary code is downloaded and installed from the location specified in szCodeURL.

The CoGetClassObjectFromURL function was designed to be used by MSHTML to retrieve the code for objects on a Web page. When the requested object is available for use on the user's computer, this function returns synchronously with a valid object reference. For objects that aren't available on the user's computer and must be downloaded from szCodeURL, the CoGetClassObjectFromURL function returns asynchronously with MK_S_ASNYNCHRONOUS and notifies the calling application through the IBindStatusCallback interface that was registered on pBindCtx.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Product

Internet Explorer 4.0

Header

Urlmon.h

Library

Urlmon.lib

DLL

Urlmon.dll