PdhGetCounterPathElements (VB)

The Visual Basic PdhGetCounterPathElements 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.

PdhGetCounterPathElements(
  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
The counter path string that is to be broken up into its individual elements.
MachineName
The string to receive the Machine name element of the counter path specified in PathString.
ObjectName
The string to receive the Object element of the counter path specified in PathString.
InstanceName
The string to receive the Instance name element, if used, of the counter path specified in PathString.
ParentInstance
The string to receive the Parent Instance element, if used, of the counter path specified in PathString.
CounterName
The string to receive the Machine name element of the counter path specified in PathString.
BufferSize
The maximum size of each string variable used as a parameter to this function call.

Return Values

If the function succeeds, it returns a Long integer equal to ERROR_SUCCESS.

If the function fails, the return value is a PDH error status defined in pdhdefs.txt. The following are possible error values:

PDH_INVALID_ARGUMENT
One or more of the string buffers is not the correct size.
PDH_INSUFFICIENT_BUFFER
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.

See Also

Performance Data Helper Overview, Performance Data Functions