Skip to content

Commit d90d13a

Browse files
committed
Fixed GroupHitTest for Vista
1 parent bb29aa0 commit d90d13a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

CGridListCtrlEx/CGridListCtrlGroups.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ int CGridListCtrlGroups::GroupHitTest(const CPoint& point)
218218

219219
if (IsGroupStateEnabled())
220220
{
221+
// Running on Vista or newer, but compiled without _WIN32_WINNT >= 0x0600
221222
#ifndef LVM_GETGROUPINFOBYINDEX
222223
#define LVM_GETGROUPINFOBYINDEX (LVM_FIRST + 153)
223224
#endif
@@ -226,6 +227,9 @@ int CGridListCtrlGroups::GroupHitTest(const CPoint& point)
226227
#endif
227228
#ifndef LVM_GETGROUPRECT
228229
#define LVM_GETGROUPRECT (LVM_FIRST + 98)
230+
#endif
231+
#ifndef LVGGR_HEADER
232+
#define LVGGR_HEADER (1)
229233
#endif
230234

231235
LRESULT groupCount = SNDMSG((m_hWnd), LVM_GETGROUPCOUNT, (WPARAM)0, (LPARAM)0);
@@ -239,8 +243,9 @@ int CGridListCtrlGroups::GroupHitTest(const CPoint& point)
239243

240244
VERIFY( SNDMSG((m_hWnd), LVM_GETGROUPINFOBYINDEX, (WPARAM)(i), (LPARAM)(&lg)) );
241245

242-
CRect rect(0,0,0,0);
246+
CRect rect(0,LVGGR_HEADER,0,0);
243247
VERIFY( SNDMSG((m_hWnd), LVM_GETGROUPRECT, (WPARAM)(lg.iGroupId), (LPARAM)(RECT*)(&rect)) );
248+
244249
if (rect.PtInRect(point))
245250
return lg.iGroupId;
246251
}

0 commit comments

Comments
 (0)