WIN32 ListView Control Column Click

Discussion in 'Win32' started by MardukLitzer, Nov 28, 2007.

  1. MardukLitzer

    MardukLitzer New Member

    Joined:
    Nov 27, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hello All, I'm having difficulty detecting the 'LVN_COLUMNCLICK' message from a ListView control. I am entering the WM_NOTIFY for sure, but I can't trap the LVN_COLUMNCLICK. Not sure where else to look, my code seems to follow what is listed on MSDN and just about every snippet I've found. Any ideas would be great!
    See Below:
    Code:
    LPNMHDR nmHdr = NULL;
    ...code here
            //WM_NOTIFY is very first case, ensures lParam integrity
            switch(message){
    	case WM_NOTIFY:
                    nmHdr = (LPNMHDR) lParam;
    		switch (nmHdr->code){
    			case LVN_COLUMNCLICK:
    				MessageBox(NULL, "CLICK DETECTED", NULL, MB_OK);
    				break;
    ...code here
    
    Also, I've tried the following:
    Code:
    ...code here
    case WM_NOTIFY:
                switch(((LPNMHDR)lParam)->code)
                      case LVN_COLUMNCLICK:
                            MessageBox(NULL, "CLICK DETECTED", NULL, MB_OK);
                return 0;
    ...code here
    
     
  2. Mandeep Dey

    Mandeep Dey New Member

    Joined:
    Jul 14, 2008
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    You can try in this way if u want get access of any particuler column click..

    Mandeep Dey
    Software Development Engineer
    SISS, KOLKATA


    case WM_NOTIFY:
    {
    LPNMLISTVIEW pnm = (LPNMLISTVIEW)lParam;

    if(NM_CLICK == ((LPNMHDR) lParam)->code )
    {
    if (0 == pnm->iSubItem)
    ::MessageBox(0, TEXT("1st Click Identified"), TEXT("Message from Mandeep..."), 0);
    if (1 == pnm->iSubItem)
    ::MessageBox(0, TEXT("2nd Click Identified"), TEXT("Message from Mandeep..."), 0);
    if (2 == pnm->iSubItem)
    ::MessageBox(0, TEXT("3rd Click Identified"), TEXT("Message from Mandeep..."), 0);
    if (3 == pnm->iSubItem)
    ::MessageBox(0, TEXT("4th Click Identified"), TEXT("Message from Mandeep..."), 0);
    }
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice