PdhCloseQuery

The PdhCloseQuery function closes all counters contained in the specified query, closes all handles related to the query, and frees all memory associated with the query.

PDH_STATUS PdhCloseQuery(
  IN HQUERY hQuery  // handle of the query to close and delete.
);
 

Parameters

hQuery
The handle of the query to close and delete.

Return Values

If the function succeeds, it returns ERROR_SUCCESS and closes and deletes the query.

If the function fails, the return value is a PDH error status defined in pdhmsg.h. The following is a possible error value:

Value Meaning
PDH_INVALID_HANDLE The query handle is not valid.

See Also

Performance Data Helper Overview, Performance Data Functions, , PdhOpenQuery