你可以响应CTreeCtrl的TVN_SELCHANGING消息:下面是从MSDN中摘出来的。
TVN_SELCHANGING 
    pnmtv = (LPNMTREEVIEW) lParam Notifies a tree view control's parent window that the selection is about to change from one item to another. This notification message is sent in the form of a WM_NOTIFY message. Returns TRUE to prevent the selection from changing. 
pnmtv 
Address of an NMTREEVIEW structure. The itemOld and itemNew members contain valid information about the currently selected item and the newly selected item. The action member indicates whether a mouse or keyboard action is causing the selection to change. For a list of possible values, see the description of the TVN_SELCHANGED notification message.