Редактиране

Споделяне чрез


SWbemObject.SpawnDerivedClass_ method

Use the SpawnDerivedClass_ method of the SWbemObject object to create a derived class object from the current object. The object must be a class definition that becomes the parent class of the spawned object.

For an explanation of this syntax, see Document Conventions for the Scripting API.

Syntax

objNewClass = .SpawnDerivedClass_( _
  [ ByVal iFlags ] _
)

Parameters

iFlags [optional]

Reserved and must be 0 (zero) if specified.

Return value

If the call is successful, the SWbemObject object contains the new class definition object. No object returns when there is an error.

Error codes

After the completion of the SpawnDerivedClass_ method, the Err object may contain one of the error codes in the following list.

wbemErrFailed - 2147749889 (0x80041001)

Unspecified error.

wbemErrIllegalOperation - 2147749918 (0x8004101E)

User requested an illegal operation, such as spawning a class from an instance.

wbemErrIncompleteClass - 2147749920 (0x80041020)

Source class was not completely defined or registered with WMI, so a new derived class is not permitted.

wbemErrOutOfMemory - 2147749894 (0x80041006)

Not enough memory to complete the operation.

Remarks

The object that is returned automatically becomes a subclass of the current object. This behavior cannot be overridden. There is no other method by which you can create derived classes.

You cannot create a derived class from a class that is local to your own client process. Before use this method to create a derived class, you must create the base class. To create the base class, call SWbemObject.Put_, and retrieve the base class using SWbemServices.Get.

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
Wbemdisp.h
Type library
Wbemdisp.tlb
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemObject
IID
IID_ISWbemObject