I have a link in a page and this link is dynamic whic I mean once it would be a .doc or .xls or .pdf or .txt.so when I click on the link I get a file dialog window and I click on Open button and the corresponding window opens.
Using QTP I would like to know which file window is opened like whether it is .doc or .xls or .pdf or .pdf and once I get that I need to close that window.
If someone has any idea for the above said question please reply to me.
<font class="small">Code:</font><hr /><pre>
On Error Resume Next
Set oTargetWindow = Nothing
Dim sWindowClass : sWindowClass = "XLMAIN,OpusApp,AcrobatSDIWindow"
Dim bWinExists : bWinExists = False
aWindowClass = Split(sWindowClass,",")
For iCounter = LBound(aWindowClass) To UBound(aWindowClass)
bWinExists = Window("regexpwndclass:=" & aWindowClass(iCounter)).Exist(0)
If bWinExists Then
Set oTargetWindow = Window("regexpwndclass:=" & aWindowClass(iCounter))
Set GetApplicationHandle = oTargetWindow
Set oOpenedWindow = GetApplicationHandle()