The Visual Basic PdhCollectQueryData function collects the current raw value of each counter in the query referenced by the QueryHandle parameter and updates the internal buffers of each counter object.
PdhCollectQueryData(
ByVal QueryHandle as Long)
as Long
If the function succeeds, it returns a Long integer equal to ERROR_SUCCESS. Note that the function can return successfully, but some or all counters in the query may not have been updated.
If the function fails, the return value is a PDH error status defined in pdhdefs.txt. The following are possible error values:
Performance Data Helper Overview, Performance Data Functions