Define System Counters for the Test
Source code
'************************************************************************************************************************
'Description:
'
' This example activates the system counters tracking functionality,
' adds several counters, and then displays the counters in a message box.
'
'************************************************************************************************************************

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start UFT
qtApp.Visible = True ' Make the UFT application visible

'qtApp.Open "C:\Tests\Test1", True ' Open the test in read-only mode

' set run settings for the test
Set qtTest = qtApp.Test
Set SCOTCounters = qtTest.Settings.LocalSystemMonitor
Set CountersList = SCOTCounters.SystemCounters
CountersList.Add "GDI Objects" , 41.2
CountersList.Add "GDI Objects" , 49.3
CountersList.Add "% User Time" , 45
CountersList.Add "Handle Count" , 43
CountersList.Add "Thread Count" , 44
'CountersList.Remove "Thread Count"
'CountersList.Remove 1
SCOTCounters.Enable = True
SCOTCounters.SampleRate = 5
SCOTCounters.ApplicationName = "calc"

qtTest.Run

Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object