#217 CListCtrlView::HitTest on Vista

v1.0 (example)
closed
None
5
2014-03-20
2009-10-24
Julijan Sribar
No

HitTest method should set content of integer pointed by pFlags to LVHT_ABOVE, LVHT_BELOW, LVHT_TOLEFT, and/or LVHT_TORIGHT when point to be tested is outside CListViewCtrl area. This is true on Windows XP. However, when the same code is run on Vista, flag is set to LVHT_NOWHERE, i.e. there is no indication that the point is outside control area.
Please note that when the same functionality is implemented with MFC, code works identically both on XP and Vista, so I suspect that WTL does not process LVM_HITTEST message on Vista correctly.
In the attached sample HitTest is used to detect when an item is dragged outside listview area. When an item in listview is being dragged, cursor changes to hand; when dragged above/below listview it should change to slashed circle - this happens on XP only.

Discussion

  • There is nothing that WTL can do here - LVM_HITTEST simply doesn't work correctly on Vista and alter, and direction flags are never returned. I tried with straight Win32 code and it is the same. I doubt that the result is different with MFC, simply because their code doesn't do anything different either.

    That means that you have to do extra checking for position in your code to check if you are outside of the client area of the list view.

     


Anonymous


Cancel   Add attachments