Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Reflectred header control messages in CListCtrl

Posted on 1998-12-21
4
Medium Priority
?
615 Views
Last Modified: 2013-11-20
I created a decendant class of CListCtrl.   When I try to handle and of the HDN_???? reflected messages, I cant.   Is this because they are being handled by CListCtrl, is it an error in MFC message reflection, or am I just expecting too much.

Just a little clarification on the words above, "I cant".   I am not receiving the reflected message, and thus, cant handle it.
0
Comment
Question by:yoffe
[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
4 Comments
 
LVL 8

Accepted Solution

by:
Answers2000 earned 150 total points
ID: 1326528
I've had this problem too.  I think the problem is that the header is a child of the list control  (not part of the list control).

Therefore the list control will receive the normal header notifications (not the reflected ones) : HDN_ENDTRACK, not =HDN_ENDTRACK for example.  Basically the class wizard is wrong.

I got around this by overriding OnNotify in my list control class, here's a sample spotting HDN_ENDTRACK from my program (this is from a class deriving from CListCtrl)

BOOL CListContact::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
      HD_NOTIFY *phdn = (HD_NOTIFY *)(lParam) ;// pNMHDR;
      if ( ( phdn->hdr.code ) == HDN_ENDTRACK )
      {
            // call base functionality (do column resize)
            BOOL bReturn = CListCtrl::OnNotify(wParam, lParam, pResult);

            CMailGuruView * pView = (CMailGuruView *)GetParent() ;
            ASSERT_VALID(pView) ;
            pView->OnColumnResize( phdn ) ;

            return bReturn ;
      }

      return CListCtrl::OnNotify(wParam, lParam, pResult);
}

0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1326529
This bit

     CMailGuruView * pView = (CMailGuruView *)GetParent() ;
     ASSERT_VALID(pView) ;
     pView->OnColumnResize( phdn ) ;

Is my code for this message.  Remove it and replace it with your own code
0
 

Author Comment

by:yoffe
ID: 1326530
Thanks 2K.   That was the same assessment that I made of the situation.   I already am handling the message in the OnNotify in my class, just didnt know if possibly I was missing a piece of the puzzle.   BTW, my code was compiled under VC++ 5.0...I assume the header's condition of being a child of the ListCtrl exists under 6.0 as well.

yoffe@flex.net
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1326531
I am using VC5 too.  I remember that it behaves the same in VC4, and would expect the same in VC6

The fact that the header control is a child is why you need to do it this way.  This fact is true for all versions of commctrl.dll I have used/tried - and actually the version of commctrl (not the version of the compiler / MFC) will determine this behaviour.  The only change that might have fixed the class wiz in 6 or later (to use normal notifications for header).  This change wouldn't break existing code.

Strictly speaking the fact the header is a child, probably counts as being "undocumented".  But given changing this will break dozens of Windows app, I expect MS  to leave it that way.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

618 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