'引用Microsoft Internet Controls
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Sub Command1_Click()
Dim IEwin As ShellWindows
Dim IE As InternetExplorer
Me.Visible = False
MsgBox "请点击一个IE窗口"
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Set IEwin = New ShellWindows
For Each IE In IEwin
If IE.hWnd = GetForegroundWindow() Then
Exit For
End If
Next
MsgBox IE.Document.body.innerHTML
End
End Sub