PdhCloseQuery (VB)

The Visual Basic PdhCloseQuery function closes the specified query and all counters related to that query. All resources allocated for the query and its counters are freed. The handles of counters added to this query should be deleted or zeroed and not used after the query they belong to is deleted.

PdhCloseQuery(
  ByVal QueryHandle as Long)  
as Long
 

Parameters

QueryHandle
The ID of the query to close and delete. Closing a query closes all the counters associated with the query.

Return Values

If the function succeeds, it returns a Long integer equal to ERROR_SUCCESS.

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

PDH_INVALID_HANDLE
The handle is invalid.

See Also

Performance Data Helper Overview, Performance Data Functions