i have these code for get the scrollbar value property:
and heres how i hook it:Code:Option Explicit Private PrevWin2 As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Declare Function SetScrollPos Lib "user32" (ByVal hwnd As Long, ByVal code As Long, ByVal nPos As Long, ByVal fRedraw As Boolean) As Long Private Declare Function GetScrollPos Lib "user32" (ByVal hwnd As Long, ByVal nBar As Long) As Long Const SB_HORZ = 0 Const SB_VERT = 1 Const SB_BOTH = 3 Private Const GWL_WNDPROC = (-4) Public lngWndPicture1 As Long Public lngWndVerticalScrollBar As Long Public lngWndHorizontalScrollBar As Long Public lngWndUserControl As Long Private Function Proc2(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Dim s As Long s = GetScrollPos(lngWndVerticalScrollBar, 1) Debug.Print s Proc2 = CallWindowProc(PrevWin2, hwnd, Msg, wParam, lParam) End Function Public Sub Hook2(Handle As Long) 'If PrevWin2 = 0 Then PrevWin2 = SetWindowLong(Handle, GWL_WNDPROC, AddressOf Proc2) 'End If End Sub Public Sub Unhook2(Handle As Long) 'If PrevWin2 Then Call SetWindowLong(Handle, GWL_WNDPROC, PrevWin2) 'PrevWin2 = 0 ' End If End Sub
how the debug value is always zero?Code:If Ambient.UserMode = False Then tmrIDEScrollClick.Enabled = True lngWndVerticalScrollBar = ScrollingVertical.hwnd Hook2 UserControl.ParentControls(0).hwnd End If
(i just need set and get the property Value on VB6 standard scrollbars)





Reply With Quote