You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
217 lines
10 KiB
217 lines
10 KiB
Attribute VB_Name = "PDH Definitions"
|
|
'
|
|
'
|
|
' Visual Basic 4.0 definitions file for use with
|
|
' PDH.DLL the Peformance Data Helper DLL
|
|
'
|
|
' Copyright (c) 1996-1999 by Microsoft Corporation
|
|
'
|
|
' 19-Apr-1996 Bob Watson
|
|
'
|
|
' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
|
'
|
|
' Pdh Error status return values
|
|
'
|
|
Public Const ERROR_SUCCESS = 0
|
|
Public Const PDH_CSTATUS_VALID_DATA = &H20000000
|
|
Public Const PDH_CSTATUS_NEW_DATA = &H20000001
|
|
Public Const PDH_CSTATUS_NO_MACHINE = &HA00007D0
|
|
Public Const PDH_CSTATUS_NO_INSTANCE = &HA00007D1
|
|
Public Const PDH_MORE_DATA = &HA00007D2
|
|
Public Const PDH_CSTATUS_ITEM_NOT_VALIDATED = &HA00007D3
|
|
Public Const PDH_RETRY = &HA00007D4
|
|
Public Const PDH_NO_DATA = &HA00007D5
|
|
Public Const PDH_CALC_NEGATIVE_DENOMINATOR = &HA00007D6
|
|
Public Const PDH_CALC_NEGATIVE_TIMEBASE = &HA00007D7
|
|
Public Const PDH_CALC_NEGATIVE_VALUE = &HA00007D8
|
|
Public Const PDH_DIALOG_CANCELLED = &HA00007D9
|
|
Public Const PDH_CSTATUS_NO_OBJECT = &HE0000BB8
|
|
Public Const PDH_CSTATUS_NO_COUNTER = &HE0000BB9
|
|
Public Const PDH_CSTATUS_INVALID_DATA = &HE0000BBA
|
|
Public Const PDH_MEMORY_ALLOCATION_FAILURE = &HE0000BBB
|
|
Public Const PDH_INVALID_HANDLE = &HE0000BBC
|
|
Public Const PDH_INVALID_ARGUMENT = &HE0000BBD
|
|
Public Const PDH_FUNCTION_NOT_FOUND = &HE0000BBE
|
|
Public Const PDH_CSTATUS_NO_COUNTERNAME = &HE0000BBF
|
|
Public Const PDH_CSTATUS_BAD_COUNTERNAME = &HE0000BC0
|
|
Public Const PDH_INVALID_BUFFER = &HE0000BC1
|
|
Public Const PDH_INSUFFICIENT_BUFFER = &HE0000BC2
|
|
Public Const PDH_CANNOT_CONNECT_MACHINE = &HE0000BC3
|
|
Public Const PDH_INVALID_PATH = &HE0000BC4
|
|
Public Const PDH_INVALID_INSTANCE = &HE0000BC5
|
|
Public Const PDH_INVALID_DATA = &HE0000BC6
|
|
Public Const PDH_NO_DIALOG_DATA = &HE0000BC7
|
|
Public Const PDH_CANNOT_READ_NAME_STRINGS = &HE0000BC8
|
|
'
|
|
' Counter Browser Detail Level Definitions
|
|
'
|
|
Public Const PERF_DETAIL_NOVICE = 100
|
|
Public Const PERF_DETAIL_ADVANCED = 200
|
|
Public Const PERF_DETAIL_EXPERT = 300
|
|
Public Const PERF_DETAIL_WIZARD = 400
|
|
'
|
|
' Standard PDH Function prototypes
|
|
'
|
|
Public Declare Function PdhOpenQuery Lib "Pdh.Dll" Alias "PdhVbOpenQuery" ( _
|
|
ByRef QueryHandle As Long) As Long
|
|
'
|
|
' PdhOpenQuery Creates an empty performance data query structure
|
|
' QueryHandle The Id of the query created is returned in this buffer
|
|
' Return Value an error code from the list above. ERROR_SUCCESS
|
|
' indicates a valid query was created and
|
|
' the value returned in QueryHandle is valid
|
|
'
|
|
Public Declare Function PdhAddCounter Lib "Pdh.Dll" Alias "PdhVbAddCounter" ( _
|
|
ByVal QueryHandle As Long, _
|
|
ByVal CounterPath As String, _
|
|
ByRef CounterHandle As Long) As Long
|
|
'
|
|
' PdhAddCounter Adds a counter to the specified query
|
|
' QueryHandle the QueryHandle of the query to add the counter to.
|
|
' This is the value initialized by the PdhOpenQuery
|
|
' function
|
|
' CounterPath the counter path string of the counter to add. This
|
|
' value can be obtained by either the
|
|
' PdhGetOneCounterPath or the PdhCreateCounterPathList
|
|
' functions
|
|
' CounterHandle The handle to the counter that is added to the query
|
|
' Return Value an error code from the list above. ERROR_SUCCESS
|
|
' indicates a valid counter was created
|
|
'
|
|
Public Declare Function PdhRemoveCounter Lib "Pdh.Dll" ( _
|
|
ByVal CounterHandle As Long) As Long
|
|
'
|
|
' PdhRemoveCounter Removes the specified counter from the query to which
|
|
' it belongs
|
|
' CounterHandle Handle of the counter to remove
|
|
' Return Value an error code from the list above. ERROR_SUCCESS
|
|
' indicates the counter was removed
|
|
'
|
|
Public Declare Function PdhCollectQueryData Lib "Pdh.Dll" ( _
|
|
ByVal QueryHandle As Long) As Long
|
|
'
|
|
' PdhCollectQueryData Obtains the current values of each counter in the
|
|
' query (the value of each counter must be retrieved
|
|
' individually using the PdhGetDoubleCounterValue,
|
|
' after the data has been updated)
|
|
' QueryHandle Handle of the query to refresh
|
|
' Return Value an error code from the list above. ERROR_SUCCESS
|
|
' indicates the function completed successfully
|
|
'
|
|
Public Declare Function PdhCloseQuery Lib "Pdh.Dll" ( _
|
|
ByVal QueryHandle As Long) As Long
|
|
'
|
|
' PdhCloseQuery Terminates data collection and frees the resources
|
|
' associated with the query
|
|
' QueryHandle Handle of query to close and free
|
|
' Return Value an error code from the list above. ERROR_SUCCESS
|
|
' indicates the query was freed
|
|
'
|
|
' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
|
|
'
|
|
' DPH VB Helper Functions
|
|
'
|
|
Public Declare Function PdhGetDoubleCounterValue Lib "Pdh.Dll" _
|
|
Alias "PdhVbGetDoubleCounterValue" ( _
|
|
ByVal CounterHandle As Long, _
|
|
ByRef CounterStatus As Long) As Double
|
|
'
|
|
' PdhGetDoubleCounterValue retrieves the value of the specified counter
|
|
' as a double precision real number
|
|
' CounterHandle The handle of the counter to retrive
|
|
' CounterStatus returns the current status of the counter
|
|
' as a PDH_ status value defined above
|
|
' Return Value The double precision real value of the counter
|
|
'
|
|
Public Declare Function PdhGetOneCounterPath Lib "Pdh.Dll" _
|
|
Alias "PdhVbGetOneCounterPath" ( _
|
|
ByVal PathString As String, _
|
|
ByVal PathLength As Long, _
|
|
ByVal DetailLevel As Long, _
|
|
ByVal CaptionString As String) As Long
|
|
'
|
|
' PdhGetOneCounterPath Displays a dialog box prompting the user to
|
|
' select one counter path
|
|
' PathString Preinitialized buffer to retrieve the path string
|
|
' PathLength Sise of initialized buffer
|
|
' DetailLevel Level of detail to filter counter display. 0
|
|
' shows all counters and hides detail combo
|
|
' box.
|
|
' CaptionString String to display in caption bar of browser
|
|
' dialog box
|
|
' Return Value returns the number of characters written to the
|
|
' PathString buffer.
|
|
'
|
|
Public Declare Function PdhCreateCounterPathList Lib "Pdh.Dll" _
|
|
Alias "PdhVbCreateCounterPathList" ( _
|
|
ByVal DetailLevel As Long, _
|
|
ByVal CaptionString As String) As Long
|
|
'
|
|
' PdhCreateCounterPathList Displays a dialog box prompting the user to
|
|
' select multiple counters Use the next
|
|
' function to read the selected path strings
|
|
' DetailLevel Level of detail to filter counter display. 0
|
|
' shows all counters and hides detail combo
|
|
' box.
|
|
' CaptionString String to display in caption bar of browser
|
|
' dialog box
|
|
' Return Value returns the number of path strings selected
|
|
'
|
|
Public Declare Function PdhGetCounterPathFromList Lib "Pdh.Dll" _
|
|
Alias "PdhVbGetCounterPathFromList" ( _
|
|
ByVal Index As Long, _
|
|
ByVal Buffer As String, _
|
|
ByVal BufferLength As Long) _
|
|
As Long
|
|
'
|
|
' PdhGetCounterPathFromList Retrieves an individual path string from the
|
|
' list created by the PdhCreateCounterPathList
|
|
' function call
|
|
' Index Index of the path string to retrieve starting
|
|
' at 1 and going to the value returned by
|
|
' the previous call to PdhCreateCounterPathList
|
|
' Buffer An initialized string buffer to retrieve the
|
|
' selected string
|
|
' BufferLength The maximum size of the buffer
|
|
' Return Value The number of characters copied to Buffer
|
|
'
|
|
'
|
|
Public Declare Function PdhGetCounterPathElements Lib "Pdh.Dll" _
|
|
Alias "PdhVbGetCounterPathElements" ( _
|
|
ByVal PathString As String, _
|
|
ByVal MachineName As String, _
|
|
ByVal ObjectName As String, _
|
|
ByVal InstanceName As String, _
|
|
ByVal ParentInstance As String, _
|
|
ByVal CounterName As String, _
|
|
ByVal BufferSize As Long) As Long
|
|
'
|
|
' PdhGetCounterPathElements Reads a performance counter path
|
|
' string and returns the components
|
|
' as individual strings
|
|
' PathString The full path string to read
|
|
' MachineName The buffer to receive the machine name
|
|
' ObjectName The buffer to receive the object name
|
|
' InstanceName The buffer to receive the instance name
|
|
' ParentInstance The buffer to receive the parent instance
|
|
' CounterName The buffer to receive the counter name
|
|
' BufferSize The size of the string buffers
|
|
'
|
|
' ReturnValue DPH status code. 0 means the function succeeded.
|
|
'
|
|
'
|
|
Public Declare Function PdhIsGoodStatus Lib "Pdh.Dll" _
|
|
Alias "PdhVbIsGoodStatus" ( _
|
|
ByVal StatusValue As Long ) As Long
|
|
'
|
|
' PdhIsGoodStatus tests the status value returned by a PDH function
|
|
' to determine if the function or value returned
|
|
' is good/success (nozero) or bad/error (zero)
|
|
'
|
|
' StatusValue the value returned by a call to a PDH function
|
|
'
|
|
' Return Value 0 if the status is not good
|
|
' non-zero if the status is good
|
|
'
|
|
'END OF PdhDefs.TXT
|
|
|