The PdhVbGetCounterPathElements function parses a fully qualified performance counter path string into its individual elements. Each of the string variables must be the same size (BufferSize) and dimensioned and initialized before it is used in this function.
Important: The function that this topic describes may be altered or unavailable in the future. Instead, Microsoft recommends that you use the functions described in Performance Counters Functions.
Function PdhVbGetCounterPathElements( _ ByVal PathString As String, _ ByVal MachineName As String, _ ByVal ObjectName As String, _ ByVal InstanceName As String, _ ByVal ParentInstance As String, _ ByVal CounterName As String, _ ByVal BufferSize As Long _ ) As Long
Parameters
PathString
Counter path string that is to be broken up into its individual elements.
MachineName
String to receive the computer name.
ObjectName
String to receive the object name.
InstanceName
String to receive the instance name, if used.
ParentInstance
String to receive the parent instance, if used.
CounterName
String to receive the counter name.
BufferSize
Maximum size of each string variable used as a parameter to this function call.
Return value
If the function succeeds, it returns a Long integer equal to ERROR_SUCCESS.
If the function fails, the return value is a system error code or a PDH error code. The following are possible values.
| Return code | Description |
|---|---|
| PDH_INVALID_ARGUMENT | One or more of the string buffers is not the correct size. |
| PDH_MORE_DATA | One or more of the counter path elements is too large for the return buffer length. |
| PDH_MEMORY_ALLOCATION_FAILURE | A temporary memory buffer could not be allocated. |
Requirements
| Requirement | Value |
|---|---|
| Minimum supported client | Windows XP [desktop apps only] |
| Minimum supported server | Windows Server 2003 [desktop apps only] |
| Library | Pdh.lib |
| DLL | Pdh.dll |
See also
Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
