IWbemClassObject::SpawnDerivedClass

[This is preliminary documentation and subject to change.]

Use the IWbemClassObject::SpawnDerivedClass method to create a new derived class object from the current object. The current object must be a class definition that becomes the superclass of the spawned object.

HRESULT IWbemClassObject::SpawnDerivedClass(
  [in] Long lFlags,
  [out] IWbemClassObject **ppNewClass
);
 

Parameters

lFlags
Reserved. It must be zero.
ppNewClass
Must not be NULL. This receives the pointer to the new class definition object. The caller must invoke IWbemClassObject::Release when the object is no longer required, typically after you have invoked IWbemServices::PutClass to write the class definition. On error, a new object is not returned, and ppNewClass is set to point to NULL.

Return Values

WBEM_E_FAILED General failure.
WBEM_E_ILLEGAL_OPERATION An illegal operation was requested, such as spawning a class from an instance.
WBEM_E_INCOMPLETE_CLASS The source class was not completely defined or registered with CIMOM, so a new derived class is not permitted.
WBEM_E_INVALID_PARAMETER ppNewClass is NULL.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the operation.
WBEM_NO_ERROR Success.

Remarks

The new object returned in ppNewClass automatically becomes a subclass of the current object. This behavior cannot be overridden. There is no other method by which derived classes can be created.

You cannot create a derived class from a class that is local to your own client process. The base class must be created and registered with CIMOM, and then retrieved using IWbemServices::GetObject before this method can be used to create a derived class. To create a class hierarchy, you must create the initial class with IWbemServices::PutClass, retrieve it using IWbemServices::GetObject, and use the retrieved object to create the newly derived class. Then, this new derived class must be created using IWbemServices::PutClass. To create other derived classes, you must call IWbemServices::GetObject , then call IWbemClassObject::SpawnDerivedClass, and so on, in a cycle for each new derivation level. You must follow this procedure in order to prevent version errors and concurrency conflicts. See Class Creation to create a class with no parent.

See Also

IWbemServices::GetObject, IWbemServices::PutClass