CoCreateInstanceEx
Creates an
instance of a specific class on a specific machine.
HRESULT CoCreateInstanceEx(
REFCLSID rclsid, |
//CLSID of the object to be created |
IUnknown
* punkOuter, |
//If part of an aggregate, the controlling IUnknown |
DWORD dwClsCtx, |
//CLSCTX values |
COSERVERINFO* pServerInfo, |
//Machine on which the object is to be instantiated |
ULONG cmq, |
//Number of MULTI_QI structures in rgmqResults |
MULTI_QI rgmqResults |
//Array of MULTI_QI structures |
); |
|
Parameters
rclsid
[in] CLSID of
the object to be created.
punkOuter
[in] When
non-NULL, indicates the instance is being created as part of an aggregate, and punkOuter
is to be used as the new instance s controlling IUnknown. Aggregation is
currently not supported cross-process or cross-machine. When instantiating an
object out of process, CLASS_E_NOAGGREGATION will be returned if punkOuter
is non-NULL.
dwClsCtx
[in] Values
taken from the CLSCTX
pServerInfo
[in] Machine
on which to instantiate the object. May be NULL, in which case the object is
instantiated on the current machine or at the machine specified in the registry
under the class s RemoteServerNameV8M0PK documentation for details).
cmq
[in] Number
of MULTI_QI structures in rgmqResults. Must be greater than zero.
rgmqResults
Array of MULTI_QI
Return Values
This function
supports the standard return value E_INVALIDARG, as well as the following:
S_OK
Indicates
success.
CO_S_NOTALLINTERFACES
At least one,
but not all of the interfaces requested in the rgmqResults array were
successfully retrieved. The hr field of each of the MULTI_QI structures
in rgmqResults indicates with S_OK or E_NOINTERFACE whether the specific
interface was returned.
E_NOINTERFACE
None of the
interfaces requested in the rgmqResults array were successfully
retrieved.
Remarks
CoCreateInstanceEx creates a single uninitialized object associated with
the given CLSID on a specified remote machine. This is an extension of the
function CoCreateInstance
The CoCreateInstanceEx
helper function encapsulates three calls: first, to CoGetClassObject
The object so
created must still be initialized through a call to one of the initialization
interfaces (such as IPersistStorage:::Load
See Also