Private Declare Function ScrollWindow Lib "user32" (ByVal hWnd As Long, ByVal XAmount As Long, ByVal YAmount As Long, lpRect As RECT, lpClipRect As RECT) As Long
Private Declare Function ScrollWindowByNum& Lib "user32" Alias "ScrollWindow" (ByVal hWnd As Long, ByVal XAmount As Long, ByVal YAmount As Long, ByVal lpRect As Long, ByVal lpClipRect As Long)
Private Declare Function ScrollWindowEx& Lib "user32" (ByVal hWnd As Long, ByVal dx As Long, ByVal dy As Long, lprcScroll As RECT, lprcClip As RECT, ByVal hrgnUpdate As Long, lprcUpdate As RECT, ByVal fuScroll As Long)
Private Declare Function ScrollWindowExByNum& Lib "user32" Alias "ScrollWindowEx" (ByVal hWnd As Long, ByVal dx As Long, ByVal dy As Long, lprcScroll As RECT, lprcClip As RECT, ByVal hrgnUpdate As Long, ByVal lprcUpdate As Long, ByVal fuScroll As Long)
Private Declare Function InflateRect Lib "user32" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
Private Declare Function UpdateWindow& Lib "user32" (ByVal hWnd As Long)
#End If 'WIN32
'**********************************
'** Type Definitions:
#If Win32 Then
Private Type RECT
left As Long
top As Long
right As Long
bottom As Long
End Type
#End If 'WIN32 Types
Private Sub cmdScroll1_Click()
Dim dl&
dl& = ScrollWindowByNum&(Me.hWnd, 15, 10, 0, 0)
End Sub
Private Sub cmdScroll2_Click()
Dim rc1 As RECT
Dim rc2 As RECT
Dim dl&
' Scroll the entire client area
dl& = GetClientRect(Me.hWnd, rc1)
LSet rc2 = rc1
' But specify a smaller clipping rectangle
dl& = InflateRect(rc2, -30, -30)
' Note how the controls don't move - but the image of them does!