Search code examples
visual-c++mfcdesktop-application

How to make subtree items respond to click event in MFC


I have a tree control in an MFC application. I have a function which displays a message box when the tree control is clicked. But I want the individual tree items and sub items to be clickable. I am new to MFC so any help will be appreciated


Solution

    1. You get a notification with NM_DBLCLK
    2. The first click of the double click will select the item. You can retrieve the item that is currently selected and double clicked with TVM_GETNEXTITEM TVGN_CARET. The MFC function is CTreeCtrl::GetSelectedItem