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 code | Description |
|---|---|
|
Method executed successfully. |
|
One or more parameters are not valid. |
|
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 |
|
|
Library |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 11/19/2012