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).He ight 'how far scrolled
With BkImage
.xOffsetPercent = 1
.yOffsetPercent = temp * playlist.files2.Height / 100
.uFlags = LVBKIF_STYLE_NORMAL
'.pszImage = oldPic
End With
Call SendMessage(playlist.files 2.hWnd, LVM_SETBKIMAGE, 0&, BkImage) 'set background image
WndProc = CallWindowProc(PlOldProcAd dr, hWnd, uMsg, wParam, lParam) 'process by default
Else
WndProc = CallWindowProc(PlOldProcAd dr, hWnd, uMsg, wParam, lParam)
end if
else
WndProc = CallWindowProc(PlOldProcAd dr, hWnd, uMsg, wParam, lParam)
end function
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.
With BkImage
.xOffsetPercent = 1
.yOffsetPercent = temp * playlist.files2.Height / 100
.uFlags = LVBKIF_STYLE_NORMAL
'.pszImage = oldPic
End With
Call SendMessage(playlist.files
WndProc = CallWindowProc(PlOldProcAd
Else
WndProc = CallWindowProc(PlOldProcAd
end if
else
WndProc = CallWindowProc(PlOldProcAd
end function
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)
(PlOldProcAddr is handle of the form)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
WM_NOTIFY is Sent by a common control to its parent window, that means u should subclass the form not the listview.