MFC Tree Control: How to detect which part of an item the user clicked on?
Q: How to detect which part of an item the user clicked on?
A: It does not matter whether we're talking about a left click, a right click or just hoovering with the mouse. IOW, the message you handle is irrelevant - the method of detecting what exactly is under the cursor is the same:
void CYourDialog::OnClickTree(NMHDR* pNMHDR, LRESULT* pResult)
hItem = m_tree.HitTest(point, &uFlags);
// There is an item under the cursor.
// See what exactly was under the cursor:
// It was the icon
// It was the button
// ...and so on
*pResult = 0;