Link to home
Start Free TrialLog in
Avatar of skullb
skullb

asked on

subclassing lvm_scroll (listview)

I`m trying to get the bg picture in the listview control
scroll in the content so it remains in the background at ALL TIMES... so I`m subclassing lvm_scroll to adjust
LVBKIMAGE.yOffsetPercent...

"debug print "called" " doesn`t even show up as if doesn`t get called as if the messages is not intercepted ...  ..

any ideas ?

sub:

Public Function WndProc(ByVal hWnd As Long, ByVal uMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long

If uMsg = WM_NOTIFY And hWnd = playlist.hWnd Then
    Dim udtNMHDR As NMHDR
    CopyMemory udtNMHDR, ByVal lParam, 12&
   
     If udtNMHDR.code = LVM_SCROLL Then
    debug print "called"
        Dim BkImage As LVBKIMAGE
       
        Dim temp As Long
        temp = U2Int(lParam) *  'U2Int ->unsigned 2  integer
    playlist.files2.ListItems.Item(1).Height 'how far scrolled
        With BkImage
            .xOffsetPercent = 1
            .yOffsetPercent = temp * playlist.files2.Height / 100
            .uFlags = LVBKIF_STYLE_NORMAL
            '.pszImage = oldPic
        End With
        Call SendMessage(playlist.files2.hWnd, LVM_SETBKIMAGE, 0&, BkImage) 'set background image
        WndProc = CallWindowProc(PlOldProcAddr, hWnd, uMsg, wParam, lParam) 'process by default
    Else
        WndProc = CallWindowProc(PlOldProcAddr, hWnd, uMsg, wParam, lParam)
end if
else
        WndProc = CallWindowProc(PlOldProcAddr, hWnd, uMsg, wParam, lParam)
end function
Avatar of egsemsem
egsemsem

hi,
  WM_NOTIFY is Sent by a common control to its parent window, that means u should subclass the form not the listview.
Avatar of skullb

ASKER

I am subclassing the form ... I think that the listview receives lvm_scroll and  it sends wm_notify to parent which will process it ... I hope I`m right...

(PlOldProcAddr is handle of the form)

ASKER CERTIFIED SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial