This is the sample code for getting the memory usage and peak memory usage for an application using QTP and writing it out in the DataTable. Here we are using the calc.exe application. This method can be used to get the data from any WinList View object.
SystemUtil.Run "taskmgr.exe"
Selection = Dialog("Windows Task Manager").WinTab("text:=Tab", "regexpwndclass:=SysTabControl32").GetROProperty("selection")
If Selection <> "Processes" Then
Dialog("Windows Task Manager").WinTab("text:=Tab1", "regexpwndclass:=SysTabControl32").Select "Processes"
End If
mem =Dialog("Windows Task Manager").WinlistView("Image Name").GetSubItem("calc.exe", "Mem Usage")
peak = Dialog("Windows Task Manager").WinlistView("Image Name").GetSubItem("calc.exe", "Peak Mem Usage")
DataTable("Percentage", "Task_Manager")= Environment.Value("Percentage")
DataTable("Memory_Usage", "Task_Manager")=mem
DataTable("Peak_Memory_Usage", "Task_Manager") = peak
when i m running these codes, parameter is incorrect message is displaying.
ReplyDeletemem =Dialog("Windows Task Manager").WinlistView("Image Name").GetSubItem("calc.exe", "Mem Usage"): parameter incorrrect.
ReplyDelete