Solved

subclassing lvm_scroll (listview)

Posted on 2001-07-07
3
969 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 28

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

726 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