Platform SDK: Performance Monitoring

PdhRemoveCounter

The PdhRemoveCounter function removes a counter from a query.

[C++] 
PDH_STATUS PdhRemoveCounter(
  HCOUNTER hCounter  
);
[Visual Basic] 
PdhRemoveCounter(
  ByVal CounterHandle as Long  
)
as Long

Parameters

[C++] hCounter
[in] A handle to the counter to remove from its query.
[Visual Basic] CounterHandle
[in] The ID of the counter returned by the PdhAddCounter function.

Return Values

If the function succeeds, it returns ERROR_SUCCESS and removes the specified counter from its query. Otherwise, the function returns a PDH error value.

The following is the possible PDH error value.

Value Meaning
PDH_INVALID_HANDLE The counter handle is not valid.

[C++] PDH error values are defined in PDHMsg.h.

[Visual Basic] PDH error values are defined in PDHDefs.txt.

Remarks

After you remove a counter, any references to it using a handle passed in hCounter will be invalid and will return an error.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Header: Declared in Pdh.h (C/C++).
  Library: Use Pdh.lib.

See Also

PdhAddCounter, PdhOpenQuery