Labels

Tuesday, 9 October 2012

Advanced QTP


Extern.Declare micHwnd, "FindWindow", "user32.dll", "FindWindowA",micString,micString

Dim Hwd
Hwd = Extern.FindWindow(null, "Untitled - Notepad")

If Hwd > 0 Then
    msgbox "inside if"
Else
    msgbox "else"
End If

''Here is a sample script to find the time zone of a machine.

Dim oWMIService, oComputer, colComputer
Dim strComputer
strComputer = "."
Set oWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Set colComputer = oWMIService.ExecQuery ("Select * from Win32_Process")
Set colComputer = oWMIService.ExecQuery ("Select * from Win32_TimeZone")
For Each oComputer in colComputer
msgbox oComputer.Description
'msgbox oComputer.Name
'msgbox oComputer.OSName
Exit For
Next
Set oComputer = Nothing
Set colComputer = Nothing
Set oWMIService = Nothing


No comments:

Post a Comment