LVN_LINKCLICK notification code

Notifies a list-view control's parent window that a link has been clicked on. This notification code is sent in the form of a WM_NOTIFY message.

LVN_LINKCLICK
        
    pLinkInfo = (NMLVLINK*) lParam;         

Parameters

lParam

Pointer to an NMLVLINK structure. The identifier of the group containing the link is in the iSubItem member.

Return value

No return value.

Remarks

The following example shows how an application might respond to this notification code in its WM_NOTIFY message handler. The example toggles the collapsed state of the group and sets the appropriate link text.

case LVN_LINKCLICK:
{
    NMLVLINK* pLinkInfo = (NMLVLINK*)lParam;
    HWND hList = pLinkInfo->hdr.hwndFrom;
    LVGROUP groupInfo;
    groupInfo.cbSize = sizeof(groupInfo);
    groupInfo.mask = LVGF_TASK;
    int groupIndex = pLinkInfo->iSubItem;
    if (ListView_GetGroupState(hList, groupIndex, LVGS_COLLAPSED))
    {
        ListView_SetGroupState(hList, groupIndex, LVGS_COLLAPSED, 0);
        groupInfo.pszTask = L"Hide";
    }
    else
    {
        ListView_SetGroupState(hList, groupIndex, LVGS_COLLAPSED, LVGS_COLLAPSED);
        groupInfo.pszTask = L"Show";
     }
      ListView_SetGroupInfo(hList, groupIndex, &groupInfo);
      break;
}

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
Header
Commctrl.h