ZjiÜt∞nφ hWnd prvku WebBrowser

Postup:
Option Explicit

Public Const GW_CHILD = 5
Public Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, _
       ByVal wCmd As Long) As Long
Public Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
       (ByVal hwnd As Long, ByVal lpClassName As String, _
       ByVal nMaxCount As Long) As Long

Public Function GetBrowserWindow(hwndBrowserContainer As Long) As Long
   
   Dim RetVal As Long
   Dim Result As Long
   Dim hwndChild As Long
   Dim hwnd As Long
   Dim ClassString As String * 256
  
   hwnd = hwndBrowserContainer
   hwndChild = hwnd
   
   While (Result = 0) And (hwndChild <> 0)
       hwndChild = GetWindow(hwnd, GW_CHILD)
       If hwndChild <> 0 Then
           hwnd = hwndChild
           RetVal = GetClassName(hwnd, ClassString, 256)
           If Left$(ClassString, InStr(ClassString, Chr$(0)) - 1) = _
               "HTML_Internet Explorer" Then
               Result = 1
           End If
       End If
   Wend
   
   GetBrowserWindow = hwnd

End Function

JedinΘ, co musφte ud∞lat, je poslat funkci GetBrowserWindow hWnd kontaineru:

Dim wb_hWnd As Long
wb_hWnd = GetBrowserWindows(Form1.hWnd)

Zp∞t

Autor: The Bozena