OleCreateDefaultHandler

Creates a new instance of the default embedding handler. This instance is initialized so it creates a local server when the embedded object enters the running state.

WINOLEAPI OleCreateDefaultHandler(
  REFCLSID clsid,      //OLE server to be loaded
  LPUNKNOWN pUnkOuter, //Pointer to controlling IUnknown if 
                       // aggregated; else NULL
  REFIID riid,         //Reference to the identifier of the 
                       // interface for communicating with handler
  LPVOID FAR * ppvObj  //Address of output variable that receives 
                       // the interface pointer  requested in riid
);
 

Parameters

clsid
[in] CLSID identifying the OLE server to be loaded when the embedded object enters the running state.
pUnkOuter
[in] Pointer to the controlling IUnknown interface if the handler is to be aggregated; NULL if it is not to be aggregated.
riid
[in] Reference to the identifier of the interface, usually IID_IOleObject, through which the caller will communicate with the handler.
ppvObj
[out] Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppvObj contains the requested interface pointer on the newly created handler.

Return Values

This function supports the standard return value E_OUTOFMEMORY, as well as the following:

NOERROR
The creation operation was successful.

Remarks

OleCreateDefaultHandler creates a new instance of the default embedding handler, initialized so it creates a local server identified by the clsid parameter when the embedded object enters the running state. If you are writing a handler and want to use the services of the default handler, call OleCreateDefaultHandler. OLE also calls it internally when the CLSID specified in an object creation call is not registered.

If the given class does not have a special handler, a call to OleCreateDefaultHandler produces the same results as a call to the CoCreateInstance function with the class context parameter assigned the value CLSCTX_INPROC_HANDLER.

QuickInfo

  Windows NT: Use version 3.1 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in ole2.h.
  Import Library: Included as a resource in ole32.dll.

See Also

CoCreateInstance, CLSCTX