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
Private Declare Function ShowScrollBar Lib "user32" (ByVal hwnd As Long, ByVal wBar As Long, ByVal bShow As Long) As Long
Private Const SC_VSCROLL = &HF070&
Private Const GW_CHILD As Long = 5
Private Const GW_HWNDNEXT As Long = 2
Private Function FindHwnd(ByVal container_hwnd As Long, ByVal target_class As String) As Long
Dim child_hwnd As Long
Dim class_name As String * 256
child_hwnd = GetWindow(container_hwnd, GW_CHILD)
Do
' See if this is the target class.
GetClassName child_hwnd, class_name, 256
If Left$(class_name, Len(target_class)) = target_class Then
' This is it.
FindHwnd = child_hwnd
Exit Do
End If
' Get the next child.
child_hwnd = GetWindow(child_hwnd, GW_HWNDNEXT)
Loop While child_hwnd <> 0
End Function
Private Sub Form_Load()
Dim web_hwnd As Long
WebBrowser1.Navigate "d:\"
web_hwnd = FindHwnd(Me.hwnd, "Shell Embedding")
Me.Caption = "webbrowser1.hwnd=" & web_hwnd
ShowScrollBar web_hwnd, SC_VSCROLL, False
End Sub
Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Private Const SM_CXVSCROLL = 2 'X Size of arrow in vertical scroll bar.
Private Const SM_CYHSCROLL = 3 'Y Size of arrow in horizontal scroll bar
Private Sub Form_Load()
' 添加一个图片框
Dim pic As PictureBox
Set pic = Controls.Add("VB.PictureBox", "pic")
Dim mywidth As Long, myheight As Long
Private Declare Function ShowScrollBar Lib "user32" (ByVal hwnd As Long, ByVal wBar As Long, ByVal bShow As Long) As Long
Private Const SC_VSCROLL = &HF070&
Private Sub Form_Load()
WebBrowser1.Navigate "d:\"
ShowScrollBar WebBrowser1.hwnd, SC_VSCROLL, False
End Sub