IWbemClassObject::NextMethod method

The IWbemClassObject::NextMethod method is used to retrieve the next method in a method enumeration sequence that starts with a call to IWbemClassObject::BeginMethodEnumeration.

This call is only supported if the current object is a CIM class definition. Method manipulation is not available from IWbemClassObject pointers that point to CIM instances.

Syntax


HRESULT NextMethod(
  [in]  LONG             lFlags,
  [out] BSTR             *pName,
  [out] IWbemClassObject **ppInSignature,
  [out] IWbemClassObject **ppOutSignature
);

Parameters

lFlags [in]

Reserved. This parameter must be 0 (zero).

pName [out]

A pointer that should point to NULL prior to the call. This parameter receives the address of a BSTR value containing the method name. The caller must release the string using SysFreeString when it is no longer required.

ppInSignature [out]

A pointer that receives a pointer to an IWbemClassObject containing the in parameters for the method.

ppOutSignature [out]

A pointer that receives a pointer to an IWbemClassObject containing the out parameters for the method.

Return value

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

WBEM_E_UNEXPECTED

An internal error occurred.

WBEM_S_NO_ERROR

The call succeeded.

WBEM_S_NO_MORE_DATA

Returned when the enumeration sequence is complete.

Example code

The following C++ example shows how to create and pass in the correct parameters to the IWbemClassObject::NextMethod method.


IWbemClassObject *pInParams = NULL;
IWbemClassObject *pOutParams = NULL;
HRESULT hr = NULL;
BSTR pName = NULL;

// The pClass variable is of type IWbemClassObject*
hr = pClass->BeginMethodEnumeration(0);

while (! FAILED(hr) && WBEM_S_NO_MORE_DATA != hr)
{
   hr = pClass->NextMethod(0, &pName, &pInParams, &pOutParams); 

   // Use the pName, pInParams, pOutParams pointers
   // ...
}
 
// - clean up
SysFreeString(pName); 
pInParams->Release();
pOutParams->Release(); 

Remarks

The caller begins the enumeration sequence using IWbemClassObject::BeginMethodEnumeration, and then calls IWbemClassObject::NextMethod until WBEM_S_NO_MORE_DATA is returned. The caller, optionally, finishes the sequence with IWbemClassObject::EndMethodEnumeration. The caller may terminate the enumeration early by calling IWbemClassObject::EndMethodEnumeration at any time.

Note  The caller must call IWbemClassObject::Release on the ppInSignature and ppOutSignature pointers when these objects are no longer required.
 

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

WbemCli.h (include Wbemidl.h)

IDL

WbemCli.idl

Library

WbemUuid.lib

DLL

CIMWin32.dll;
Esscli.dll;
Fastprox.dll;
FrameDyn.dll;
FrameDynOS.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

 

 

Show: