Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

IWbemClassObject::SpawnDerivedClass method

Use the IWbemClassObject::SpawnDerivedClass method to create a newly derived class object from the current object. The current object must be a class definition that becomes the parent class of the spawned object. The returned object becomes a subclass of the current object.

Syntax


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

Parameters

lFlags [in]

Reserved. This parameter must be 0.

ppNewClass [out]

Cannot 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 left unmodified.

Return value

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

Return codeDescription
WBEM_E_FAILED

There has been a general failure.

WBEM_E_INVALID_OPERATION

An invalid 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 Windows Management, 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_S_NO_ERROR

The call succeeded.

 

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 subclasses (derived classes) can be created.

You cannot create a derived class from a class that is local to your own client process. The parent class (base class) must be created and registered with Windows Management using IWbemServices::PutClass, 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 newly 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 to prevent version errors and concurrency conflicts. For more information about creating a class with no parent, see Creating a Class.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

WbemCli.h (include Wbemidl.h)

IDL

WbemCli.idl

Library

WbemUuid.lib

DLL

CIMWin32.dll;
Esscli.dll;
Evntrprv.dll;
Fastprox.dll;
Framedyn.dll;
Krnlprov.dll;
Ncprov.dll;
Wbemcore.dll;
Wbemess.dll;
Wmipiprt.dll

CLSID

CLSID_WbemClassObject is defined as 9A653086-174F-11d2-B5F9-00104B703EFD

IID

IID_IWbemClassObject is defined as dc12a681-737f-11cf-884d-00aa004b2e24

See also

IWbemClassObject
IWbemServices::GetObject
IWbemServices::PutClass

 

 

Show:
© 2015 Microsoft