IWbemClassObject::SpawnInstance method (wbemcli.h)

Use the IWbemClassObject::SpawnInstance method to create a new instance of a class. The current object must be a class definition obtained from Windows Management using IWbemServices::GetObject, IWbemServices::CreateClassEnum, or IWbemServices::CreateClassEnumAsync Then, use this class definition to create new instances.

A call to IWbemServices::PutInstance is required to actually write the instance to Windows Management. If you intend to discard the object before calling IWbemServices::PutInstance, simply make a call to IWbemClassObject::Release.

Note that spawning an instance from an instance is supported but the returned instance will be empty.

Syntax

HRESULT SpawnInstance(
  [in]  long             lFlags,
  [out] IWbemClassObject **ppNewInstance
);

Parameters

[in] lFlags

Reserved. This parameter must be 0.

[out] ppNewInstance

Cannot be NULL. It receives a new instance of the class. The caller must invoke IWbemClassObject::Release when the pointer is no longer required. On error, a new object is not returned and the pointer is left unmodified.

Return value

This method returns an HRESULT indicating the status of the method call. The following list lists the value contained within an HRESULT. For general HRESULT values, see System Error Codes.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header wbemcli.h (include Wbemidl.h)
Library WbemUuid.lib
DLL CIMWin32.dll; Esscli.dll; Fastprox.dll; FrameDyn.dll; FrameDynOS.dll; Krnlprov.dll; Ncprov.dll; Wbemcore.dll; Wbemess.dll; Wmipiprt.dll

See also

IWbemClassObject

IWbemServices::GetObject

IWbemServices::PutInstance