August 12th, 2003, 12:26 PM
CListView & HDN_ENDTRACK - there stay vertical lines
in my CListView-derived class I added handler for HDN_ENDTRACKW notification, which looks like this:
The problem is, that now, after having added this handler, when I'm resizing any column (dragging the divider) and I finish dragging, there stays vertical line pointing from divider perpendicularly to the bottom of ListView. When I handle only HDN_BEGINTRACKW (and set *pResult to 0), everything is ok.
void CMyFileView::OnEndColumnResizing(NMHDR* pNMHDR, LRESULT* pResult)
*pResult = 0;
What's the problem with that?
April 16th, 2014, 04:39 AM
Re: CListView & HDN_ENDTRACK - there stay vertical lines
After partying 10th anniversary of this problem I finally found a solution for it.
Short story: call CWnd::Default from your HDN_ENDTRACK-handler
Just recently I had the same problem and figured out that HDN_ENDTRACK is not only a notification for the end-user, but also a necessary message for the correct drawing (i.e. removing the vertical lines) of the parent list-ctrl: the drawing problem arises the moment you install an MFC-notify-handler for HDN_ENDTRACK.
The difference is then in the function
that for the HDN_ENDTRACK-notification OnWndMsg will return TRUE if and ony if there is a handler for it and thus, if there is a handler won't call DefWindowProc.
// code from MFC: wincore.cpp lines 2133-2140 (MSVC 11, VS 2012)
LRESULT CWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
// OnWndMsg does most of the work, except for DefWindowProc call
LRESULT lResult = 0;
if (!OnWndMsg(message, wParam, lParam, &lResult))
lResult = DefWindowProc(message, wParam, lParam);
As there doesn't exists a OnNotifyEx-handler (blame whoever you want) IMO the best way to handle it is calling CWnd::Default() from your HDN_ENDTRACK-handler.
Originally Posted by s_k
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.