Solved

subclassing lvm_scroll (listview)

Posted on 2001-07-07
3
979 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

729 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