Collects the current raw data value for all counters in the specified query and updates the status code of each counter.
PDH_FUNCTION PdhCollectQueryData( PDH_HQUERY hQuery );
Handle of the query for which you want to collect data. The PdhOpenQuery function returns this handle.
The following are possible values.
||The query handle is not valid.|
||The query does not currently contain any counters. The query may not contain data because the user is not running with an elevated token (see Limited User Access Support).|
Call this function when you want to collect counter data for the counters in the query. PDH stores the raw counter values for the current and previous collection.
If you want to retrieve the current raw counter value, call the PdhGetRawCounterValue function. If you want to compute a displayable value for the counter value, call the PdhGetFormattedCounterValue function. If the counter path contains a wildcard for the instance name, instead call the PdhGetRawCounterArray and PdhGetFormattedCounterArray functions, respectively.
When PdhCollectQueryData is called for data from one counter instance only and the counter instance does not exist, the function returns PDH_NO_DATA. However, if data from more than one counter is queried, PdhCollectQueryData may return ERROR_SUCCESS even if one of the counter instances does not yet exist. This is because it is not known if the specified counter instance does not exist, or if it will exist but has not yet been created. In this case, call PdhGetRawCounterValue or PdhGetFormattedCounterValue for each of the counter instances of interest to determine whether they exist.
The following shows the syntax if calling this function from Visual Basic.
PdhCollectQueryData( ByVal QueryHandle as Long ) as Long
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|