Platform SDK: Performance Monitoring |
The PdhVbAddCounter function creates a counter entry in the specified query object, and returns a handle to that counter upon successful completion.
PdhVbAddCounter( ByVal QueryHandle as Long, ByVal CounterPath as String, ByRef CounterHandle as Long ) as Long
If the function succeeds, it returns a Long integer equal to ERROR_SUCCESS and a new handle in the CounterHandle variable.
If the function fails, the return value is a PDH error status defined in PDHDefs.txt. The following are possible error values.
Error value | Description |
---|---|
PDH_INVALID_ARGUMENT | One or more of the arguments is invalid or incorrect. |
PDH_MEMORY_ALLOCATION_FAILURE | A memory buffer could not be allocated. |
PDH_INVALID_HANDLE | The query handle is not valid. |
PDH_CSTATUS_NO_COUNTER | The specified counter was not found. |
PDH_CSTATUS_NO_OBJECT | The specified object could not be found. |
PDH_CSTATUS_NO_MACHINE | A machine entry could not be created. |
PDH_CSTATUS_BAD_COUNTERNAME | An empty counter name path string was passed in. |
PDH_FUNCTION_NOT_FOUND | The calculation function for this counter could not be determined. |
Windows NT/2000: Requires Windows NT 4.0 or later.
Library: Use Pdh.lib.