hi, im trying to use APIs to set the scroll position of a WebBrowser control,
but it wont do anything, yet a textbox will....heres the code
' Scrollbar direction
'
Const SBS_HORZ = 0
Const SBS_VERT = 1
' Windows Messages
'
Const WM_VSCROLL = &H115
Const WM_HSCROLL = &H114
Const SB_THUMBPOSITIO N = 4
Private Declare Function GetScrollPos Lib "user32.dll " ( _
ByVal hWnd As IntPtr, _
ByVal nBar As Integer) As Integer
Private Declare Function SetScrollPos Lib "user32.dll " ( _
ByVal hWnd As IntPtr, _
ByVal nBar As Integer, _
ByVal nPos As Integer, _
ByVal bRedraw As Boolean) As Integer
Private Declare Function PostMessageA Lib "user32.dll " ( _
ByVal hwnd As IntPtr, _
ByVal wMsg As Integer, _
ByVal wParam As Integer, _
ByVal lParam As Integer) As Boolean
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim hwnd As IntPtr = Me.WebBrowser1. Handle
Dim pos As Integer = GetScrollPos(hw nd, SBS_VERT) + 5
If (SetScrollPos(h wnd, SBS_VERT, pos, True) <-1) Then
PostMessageA(hw nd, WM_VSCROLL, pos, Nothing)
Else
MsgBox("Can't set info (Err: " & GetLastWin32Err or() & ")")
End If
End Sub
--
-iwdu15
but it wont do anything, yet a textbox will....heres the code
' Scrollbar direction
'
Const SBS_HORZ = 0
Const SBS_VERT = 1
' Windows Messages
'
Const WM_VSCROLL = &H115
Const WM_HSCROLL = &H114
Const SB_THUMBPOSITIO N = 4
Private Declare Function GetScrollPos Lib "user32.dll " ( _
ByVal hWnd As IntPtr, _
ByVal nBar As Integer) As Integer
Private Declare Function SetScrollPos Lib "user32.dll " ( _
ByVal hWnd As IntPtr, _
ByVal nBar As Integer, _
ByVal nPos As Integer, _
ByVal bRedraw As Boolean) As Integer
Private Declare Function PostMessageA Lib "user32.dll " ( _
ByVal hwnd As IntPtr, _
ByVal wMsg As Integer, _
ByVal wParam As Integer, _
ByVal lParam As Integer) As Boolean
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim hwnd As IntPtr = Me.WebBrowser1. Handle
Dim pos As Integer = GetScrollPos(hw nd, SBS_VERT) + 5
If (SetScrollPos(h wnd, SBS_VERT, pos, True) <-1) Then
PostMessageA(hw nd, WM_VSCROLL, pos, Nothing)
Else
MsgBox("Can't set info (Err: " & GetLastWin32Err or() & ")")
End If
End Sub
--
-iwdu15
Comment