ART_Mac03
asked on
vbscript: how can I use the process id to get a windows handle
I can capture all the process ids for a client under test, but I currently at a loss on how to convert those ids into window handles.
Process Id Code
Process Id Code
Function ProcessId
'capture the hwnd from all windows with a certain caption
set objService = getobject("winmgmts:")
For each Process in objService.InstancesOf("Win32_process")
If Process.Name = "FronTIER.exe" Then
ret = msgbox(Process.processid, vbOkCancel)
If ret = vbCancel Then
ExitTest micWarning
End If
End If
Next
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
let me try this. I do not know I could not think of this simple solution.
I need to my code simple due to my users; your solution can be what they would like.
I need to my code simple due to my users; your solution can be what they would like.
ASKER
typo: I do not know why I did not think of this solution.
ASKER
The solution was helpful especially since the info. displayed to my user community was direct and non-complex.
I eventually found a different way to solve my org. problem with using Process IDs to determine Window handles. I am using the test tool QTP to capture the windows object data based on the Swfname of the application or the object name of a feature in the app. I pass the object name based on the process ID/name of the process.
I eventually found a different way to solve my org. problem with using Process IDs to determine Window handles. I am using the test tool QTP to capture the windows object data based on the Swfname of the application or the object name of a feature in the app. I pass the object name based on the process ID/name of the process.
ASKER
thanks for both solutions.
>tasklist | findstr <PID>