Solved

subclassing lvm_scroll (listview)

Posted on 2001-07-07
3
933 Views
Last Modified: 2007-12-19
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
0
Comment
Question by:skullb
3 Comments
 
LVL 2

Expert Comment

by:egsemsem
Comment Utility
hi,
  WM_NOTIFY is Sent by a common control to its parent window, that means u should subclass the form not the listview.
0
 

Author Comment

by:skullb
Comment Utility
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)

0
 
LVL 27

Accepted Solution

by:
Ark earned 300 total points
Comment Utility
Hi
You have to subclass ListView and wait for WM_VSCROLL message.
Take a look at http://www.mvps.org/vbnet/index.html?code/subclass/lvscrollbars.htm for sample.

And, IMHO, you need to set yOffset = 0 in every scroll event.

Cheers
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now