SpawnDerivedClass function

Creates a newly derived class object from a specified object.

Note

This API is for internal use only. It's not intended for use from developer code.

Syntax

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

Parameters

vFunc
[in] This parameter is unused.

ptr
[in] A pointer to an IWbemClassObject instance.

lFlags
[in] Reserved. This parameter must be 0.

ppNewClass
[out] Receives the pointer to the new class definition object. If an error occurs, a new object is not returned, and ppNewClass is left unmodified. Its value cannot be null.

Return value

The following values returned by this function are defined in the WbemCli.h header file, or you can define them as constants in your code:

Constant Value Description
WBEM_E_FAILED 0x80041001 There has been a general failure.
WBEM_E_INVALID_OPERATION 0x80041016 An invalid operation, such as spawning a class from an instance, was requested.
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_OUT_OF_MEMORY 0x80041006 Not enough memory is available to complete the operation.
WBEM_E_INVALID_PARAMETER 0x80041008 ppNewClass is null.
WBEM_S_NO_ERROR 0 The function call was successful.

Remarks

This function wraps a call to the IWbemClassObject::SpawnDerivedClass method.

ptr must be a class definition that becomes the parent class of the spawned object. The returned object becomes a subclass of the current object.

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.

Requirements

Platforms: See System Requirements.

Header: WMINet_Utils.idl

.NET Framework Versions: Available since 4.7.2

See also