GetPropertyHandle function

Returns a unique handle that identifies a property.

Note

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

Syntax

HRESULT GetPropertyHandle (
   [in] int                  vFunc,
   [in] IWbemObjectAccess*   ptr,
   [in] LPCWSTR              wszPropertyName,
   [out] CIMTYPE*            pType,
   [out] long*               pHandle
);

Parameters

vFunc
[in] This parameter is unused.

ptr
[in] A pointer to an IWbemObjectAccess instance.

wszPropertyName
[in] A null-terminated string of UTF16-encoded characters that contains the property name.

pType
[out] A pointer to a CIMTYPE enumeration member that represents the CIM type of the property.

pHandle
[out] A pointer to an integer that contains the property handle.

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_NOT_FOUND 0x80041002 The specified property name was not found.
WBEM_E_INVALID_PARAMETER 0x80041008 A parameter is not valid.
WBEM_E_NOT_SUPPORTED 0x8004100c The requested property is of type are CIM_OBJECT or CIM_ARRAY.
WBEM_S_NO_ERROR 0 The function call was successful.

Remarks

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

You can use this handle to identify properties when using IWbemObjectAccess methods to read or write property values.

Handles can be retrieved for properties of all data types other than CIM_OBJECT and CIM_ARRAY. Returned handles work across all instances of a class.

Requirements

Platforms: See System Requirements.

Header: WMINet_Utils.idl

.NET Framework Versions: Available since 4.7.2

See also