1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 | Private Declare Function GetScrollPos Lib "user32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal nBar As Integer) As Integer
'Example: position = GetScrollPos(textbox1.handle, SBS_HORZ)
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
'Example: SetScrollPos(hWnd, SBS_HORZ, position, True
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
'Example: PostMessageA(hWnd, WM_HSCROLL, SB_THUMBPOSITION _
' + &H10000 * position, Nothing)
If (SetScrollPos(hWnd, SBS_HORZ, position, True) <> -1) Then
PostMessageA(hWnd, WM_HSCROLL, SB_THUMBPOSITION +_
&H10000 * position, Nothing)
Else
MsgBox("Can't set info (Err: " & GetLastWin32Error() & ")")
End If
Dim Position = GetScrollPos(hWnd, SBS_VERT) + 20
If (SetScrollPos(hWnd, SBS_VERT, position, True) <> -1) Then
PostMessageA(hWnd, WM_VSCROLL, SB_THUMBPOSITION + _
&H10000 * position, Nothing)
Else
MsgBox("Can't set info (Err: " & GetLastWin32Error() & ")")
End If
|
沒有留言:
張貼留言