Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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.

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.

Examples

For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.

For C++ code examples, see WMI C++ Application Examples.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

Wbemcli.h (include Wbemidl.h)

Library

Wbemuuid.lib

DLL

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

See also

IWbemClassObject
IWbemServices::GetObject
IWbemServices::PutClass

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.