IWbemContext::GetNames method

The IWbemContext::GetNames method returns a SAFEARRAY structure of all of the names of the named context values. After all the names are known, GetValue can be called on each name to retrieve the value. This technique is a way of accessing the context values that is different from calling the BeginEnumeration, Next, and EndEnumeration methods.

Syntax


HRESULT GetNames(
  [in]   LONG lFlags,
  [out]  SAFEARRAY (BSTR) **pNames
);

Parameters

lFlags [in]

Reserved. This parameter must be 0.

pNames [out]

This parameter cannot be NULL, but on entry it must point to NULL. If no error is returned, on exit pstrNames receives a pointer to a new SAFEARRAY structure of type VT_BSTR containing all the context value names. The caller must call SafeArrayDestroy on the returned pointer when the array is no longer required. If an error code is returned, the pointer is left unmodified.

Note  If there are no named values in the object, the call succeeds and returns an array of length 0.

Return value

This method returns an HRESULTHRESULT indicating the status of the method call. The following table lists the value contained within an HRESULTHRESULT.

Return codeDescription
WBEM_E_INVALID_PARAMETER

A specified parameter is not valid.

WBEM_E_OUT_OF_MEMORY

There was not enough memory to complete the operation.

WBEM_S_NO_ERROR

The call succeeded.

 

Remarks

For more information about using SAFEARRAY structures of BSTR values, see Retrieving Part of an Instance.

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

Esscli.dll;
Fastprox.dll;
Framedyn.dll;
Wbemcomn.dll;
Wbemcore.dll;
Wbemess.dll;
Wmipjobj.dll

See also

IWbemContext
IWbemContext::BeginEnumeration
IWbemContext::GetValue

 

 

Show:
© 2014 Microsoft