Solved

subclassing lvm_scroll (listview)

Posted on 2001-07-07
3
947 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
ID: 6262151
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
ID: 6262951
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
ID: 6264338
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

910 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

16 Experts available now in Live!

Get 1:1 Help Now