PdhCollectQueryData

The PdhCollectQueryData function collects the current raw data value for all counters in the specified query and updates the status code of each counter.

PDH_STATUS PdhCollectQueryData(
  IN HQUERY hQuery  // handle of the query
);
 

Parameters

hQuery
The handle of the query from which to collect data.

Return Values

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:

Value Meaning
PDH_INVALID_HANDLE The query handle is not valid.
PDH_NO_DATA The query does not currently have any counters.

Remarks

The PdhCollectQueryData function can succeed, but may not have collected data for all counters. Always check the status code of each counter in the query before using the data.

See Also

Performance Data Helper Overview, Performance Data Functions, , PdhOpenQuery