|
-
March 12th, 2007, 11:13 AM
#1
Problem with subclassing ListCtrl
I tried to subclass a ListCtrl (SysListView32-CommonCtrl) in a DialogBox by calling
OldListCtrlWndProc = ( WNDPROC )::SetWindowLong( m_hWndListCtrl, GWL_WNDPROC, ( DWORD )NewListCtrlWndProc );
in the WM_INITDIALOG-Handler, with
LRESULT ( CALLBACK* OldListCtrlWndProc )( HWND, UINT, WPARAM, LPARAM );
LRESULT CALLBACK NewListCtrlWndProc( HWND hWnd, WORD Message, WPARAM wParam, LPARAM lParam )
{
return CallWindowProc( OldListCtrlWndProc, hWnd, Message, wParam, lParam );
}
Whenever this code is in effect, the background and frame of my ListCtrl isn't painted anymore. The Items and subitems as well as the header-control are drawn correctly.
I abused the CANCEL-Button to toggle old and new ListCtrl-WndProc. With Spy++ I investigated the Messages, the control receives, either with the new and the old (original) WndProc but I couldn't make out any difference asides the fact, that in Spy++-properties-window the address of the windows-procedure changes. (When the new proc is active, it has a strange address of 0xffff****, followed by "(As subclass)", in contrast to 0x0******* (Unicode) with the original one.)
Any ideas? I browsed the web for this problem for serveral days, but nobody seems to have a problem like this one.
Thanks in advance
Last edited by bobbyb; March 12th, 2007 at 11:15 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|