The PdhGetFormattedCounterValue function returns the current value of a specified counter in the format requested by the caller.
PDH_STATUS PdhGetFormattedCounterValue(
IN HCOUNTER hCounter, // handle of the counter
IN DWORD dwFormat, // formatting flag
IN LPDWORD lpdwType, // counter type
IN PPDH_FMT_COUNTERVALUE pValue // counter value
);
The value selected from the previous table can be combined using the OR operator with one of the following scaling flags:
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:
The data for the counter is locked (protected) for the duration of the call to PdhGetFormattedCounterValue to prevent any changes during the processing of the call. Reading the data (calling this function successfully) clears the data-changed flag for the counter.
Performance Data Helper Overview, Performance Data Functions, , PdhGetRawCounterValue, PdhSetCounterScaleFactor