This topic has not yet been rated - Rate this topic

IWbemPathKeyList::GetKey2 method

The IWbemPathKeyList::GetKey2 method retrieves a key name or value, and returns the value as a VARIANT. A key is indexed from 0 (zero), but the key order is not significant.

Syntax


HRESULT GetKey2(
  [in]       ULONG uKeyIx,
  [in]       ULONG uFlags,
  [in, out]  ULONG *puNameBufSize,
  [out]      LPWSTR pszKeyName,
  [out]      VARIANT *pKeyVal,
  [out]      ULONG *puApparentCimType
);

Parameters

uKeyIx [in]

Key index begins at 0 (zero).

uFlags [in]

Reserved. Must be 0 (zero).

puNameBufSize [in, out]

Caller sets this parameter to the number of characters that the name buffer can hold. When successful, this is set to the number of characters that are copied into the buffer—including the terminating NULL.

pszKeyName [out]

Buffer into which the name is copied. Because not all keys have a name, this parameter value is NULL for an implicit key.

pKeyVal [out]

Pointer to a variant that contains the key value.

puApparentCimType [out]

Pointer to a long integer that is set to the CIM type.

Return value

This method returns an HRESULT that indicates the status of the method call.

Return codeDescription
S_OK

Method executed successfully.

WBEM_E_INVALID_PARAMETER

One or more parameters are not valid.

WBEM_E_OUT_OF_MEMORY

Insufficient memory to perform the operation.

 

Remarks

This method can be used to determine how big a buffer is needed by passing in a NULL pointer for the buffer and setting its size parameter to 0 (zero). When returned, the buffer size parameter indicates the size buffer that is needed for the string and its NULL terminator.

Windows 2000 and Windows NT:  Requires the WMI SDK Update or the Microsoft .NET Framework SDK. For more information about obtaining this SDK, see Windows Management Instrumentation.
Windows NT:  Requires the Microsoft .NET Framework SDK. For more information about obtaining this SDK, see Windows Management Instrumentation.

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 [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Redistributable

WMI Redistributable Components version 1.0 on Windows 2000.

Header

Wmiutils.h

Library

Wbemuuid.lib

DLL

Wmiutils.dll

See also

IWbemPath
IWbemPathKeyList
IWbemPathKeyList::GetKey

 

 

Send comments about this topic to Microsoft

Build date: 11/19/2012

Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.