PDA

Click to See Complete Forum and Search --> : Handle of IE window


eng70640
Mar 8th, 2001, 08:04 AM
Hi , as we know notice the caption of the IE window changes as we surf net . The 'findwindow' api can use caption or classname to find handles. Is it possible to define a classname & use 'findwindow' api to find the handle of the IE window even when its caption has change ? Actually , i was wondering if there is a universal classname for IE windows so that i can use to obtain the handle of the IE window even after it caption has changed .

Mar 8th, 2001, 10:34 AM
Internet Explorer's classname is ieframe.


Private Declare Function FindWindow _
Lib "user32.dll" Alias "FindWindowA" (ByVal _
lpClassName As String, ByVal lpWindowName As String) _
As Long


Private Sub Command1_Click()

Dim hWin As Long
hWin = FindWindow("ieframe", vbNullString)
If hWin <> 0 Then
Msgbox "IE hWnd: " & hWin
Else
Msgbox "Window not found!", 16
End If

End Sub