Hallo Wissende,
mit nachfolgendem zusammengebastelten Code kann ich die hwnd und Titel von laufenden IE und Mozilla-Browsern auslesen.
a) Wie kann ich nun ermitteln auf welche URL-Adressen die Browser gerade zugreifen?
b) Wie kann ich die gerade aktuelle Seite im Browser auslesen
c) Bei Frames auf der Seite, wie kann ich diese auslesen?
d) Ist es möglich bei Änderungen in b) c) automatisch zu aktualisieren, also nochmals auszulesen, quasi eine Überwachung?
( d) ist u.a. wegen http://www.wer-weiss-was.de/cgi-bin/forum/showarticl… )
Danke & schönes neues Jahr für Euch Alle
Gruß Reinhard
Option Explicit
Private Const GW\_HWNDNEXT = 2
Private Const GW\_HWNDFIRST = 0
Private Declare Function FindWindow \_
Lib "user32" Alias \_
"FindWindowA" ( \_
ByVal lpClassName As String, \_
ByVal lpWindowName As String \_
) As Long
Private Declare Function GetWindowText \_
Lib "user32" Alias \_
"GetWindowTextA" ( \_
ByVal hwnd As Long, \_
ByVal lpString As String, \_
ByVal cch As Long \_
) As Long
Private Declare Function GetWindow \_
Lib "user32" ( \_
ByVal hwnd As Long, \_
ByVal wCmd As Long \_
) As Long
Private Declare Function GetClassName \_
Lib "user32" Alias \_
"GetClassNameA" ( \_
ByVal hwnd As Long, \_
ByVal lpClassName As String, \_
ByVal nMaxCount As Long \_
) As Long
'
Sub tt()
Dim hwnd As Long, strCaption As String, lngLen As Long, strClass As String
Dim Zei As Long
Cells.ClearContents
If hwnd = 0 Then
hwnd = FindWindow(vbNullString, vbNullString)
End If
hwnd = GetWindow(hwnd, GW\_HWNDFIRST)
Do While hwnd 0
strClass = String(255, 0)
lngLen = GetClassName(hwnd, strClass, Len(strClass))
strClass = Left(strClass, lngLen)
strCaption = String(255, 0)
lngLen = GetWindowText(hwnd, strCaption, Len(strCaption))
strCaption = Left(strCaption, lngLen)
If strClass = "IEFrame" Then MsgBox "IE" & hwnd
If strClass = "MozillaUIWindowClass" Then MsgBox "MZ" & hwnd
Zei = Zei + 1
Range("A" & Zei) = strClass
Range("B" & Zei) = strCaption
hwnd = GetWindow(hwnd, GW\_HWNDNEXT)
Loop
End Sub