Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
How to detect a mouse click on any column of a List View control in Visual C++
Article ID: 147842 - View products that this article applies to.
This article was previously published under Q147842
Note Microsoft Visual C++ .NET 2002 and Microsoft Visual C++ .NET 2003 support both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model. The information in this article applies only to unmanaged Visual C++ code.
By design, a left-mouse click on a column other than the first column of a List View control when the control is in report view will not select the first column of that row. This article presents a way to detect the mouse click, and highlight the first column of the row where the mouse was clicked.
Step-by-step procedureThe List View control will send a NM_CLICK notification code to its parent window whenever the user has clicked the left mouse button within its client area. Below are the necessary steps to intercept this notification code in the control itself (instead of the parent window) and to highlight the first column of the row that is being clicked:
By design, a List View control in a report view will only highlight the first column of a row.
Article ID: 147842 - Last Review: November 21, 2006 - Revision: 5.2