I set-up a message handler to handle a single click in a tree control. I'm trying to get the item text with a single

click. A member variable is associated with the tree (m_tree). A member variable is associated with an edit box in

the dialog (m_text).

The problem is, when I click on the first item nothing happens. When I click on the second item, the first item shows

up. Click on the third ... get the second, and so on. It seems that I'm not really selecting until another mouse

event click (two clicks on the same item will get that item's text).

How do I get the text of the item on the first click?

Here's the code I'm using.

void CMyDlg::OnClickTree1(NMHDR* pNMHDR, LRESULT* pResult)

{

HTREEITEM hItem=m_tree.GetSelectedItem();

if(hItem)

{

m_text=m_tree.GetItemText(hItem);

UpdateData(FALSE);

}


*pResult = 0;

}