Re: CListView Vista Problem
On Mon, 14 Jan 2008 13:14:01 -0800, Marc <Marc@discussions.microsoft.com>
wrote:
We are modifying a CListView Control as follows:
void CMyListView::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
int iItem;
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if (!pNMListView->uOldState && !pNMListView->uNewState)
return;
// Process the click
...
}
When we use this control with the above custom code in Windows XP, Clicking
in the checkbox results in:
pNMListView->uOldState = 1031
pNMListView->uNewState = 0
and the rest of our code executes just fine.
When we use this control in Windows Vista, Clicking in the checkbox results
in:
pNMListView->uOldState = 0
pNMListView->uNewState = 0
and the rest of our code does not execute.
If I remove the check "if (!pNMListView->uOldState &&
!pNMListView->uNewState)", the code executes just fine, but I'd like to
understand why the values are different for XP and Vista before removing this
check.
You should be handling LVN_ITEMCHANGING and/or LVN_ITEMCHANGED. Per the
NM_CLICK documentation:
http://msdn2.microsoft.com/en-us/library/bb774863(VS.85).aspx
lpnmitem
Version 4.71. Pointer to an NMITEMACTIVATE structure that contains
additional information about this notification message. The iItem,
iSubItem, and ptAction members of this structure contain information about
the item.
--
Doug Harrison
Visual C++ MVP