Platform SDK: Performance Monitoring |
The PdhGetDefaultPerfCounter function retrieves the name of the default counter for the specified object. This name can be used to set the initial selection of the counter browser list/combo box.
PDH_STATUS PdhGetDefaultPerfCounter( LPCTSTR szDataSource, LPCTSTR szMachineName, LPCTSTR szObjectName, LPTSTR szDefaultCounterName, LPDWORD pcchBufferSize );
Windows NT 4.0: Reserved. Must be NULL.
If the function succeeds, it returns ERROR_SUCCESS.
If the function fails, the return value is a PDH error status defined in PDHMsg.h. The following are possible error values.
Error value | Description |
---|---|
PDH_INSUFFICIENT_BUFFER | The buffer provided is not large enough for the available data. |
PDH_INVALID_ARGUMENT | A required argument is invalid or a reserved argument is not NULL. |
PDH_MEMORY_ALLOCATION_FAILURE | A required temporary buffer could not be allocated. |
PDH_CSTATUS_NO_MACHINE | The specified machine is offline or unavailable. |
PDH_CSTATUS_NO_COUNTERNAME | The default object name cannot be read or found. |
PDH_CSTATUS_NO_OBJECT | The specified object could not be found on the specified machine. |
PDH_CSTATUS_NO_COUNTER | The default counter was not found in the specified object. |
Windows NT/2000: Requires Windows NT 4.0 or later.
Header: Declared in Pdh.h.
Library: Use Pdh.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.