How to use function "OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult) " on ctreectrl?
-
Huh? Do you mean how to add a DeleteItem notification handler, or what to do when you get it? To add the notification, you need to add
afx_msg void OnDeleteTreeItem(NMHDR *pNMHDR, LRESULT *pResult);
to your header, then add:
ON_NOTIFY(TVN_DELETEITEM, IDC_MY_TREE_CTRL, OnDeleteTreeItem)
to your message map. Finally, add the handler to your .cpp file:
void CMyClass::OnDeleteTreeItem(NMHDR *pNMHDR, LRESULT *pResult)
{
NMTREEVIEW *pTreeNotify = (NMTREEVIEW *)pNMHDR;// Now pTreeNotify->itemOld.hItem is the HTREEITEM of the deleted tree item
}As to what you do in the handler, that's up to you... ------------------------ Derek Waters derek@lj-oz.com
-
Huh? Do you mean how to add a DeleteItem notification handler, or what to do when you get it? To add the notification, you need to add
afx_msg void OnDeleteTreeItem(NMHDR *pNMHDR, LRESULT *pResult);
to your header, then add:
ON_NOTIFY(TVN_DELETEITEM, IDC_MY_TREE_CTRL, OnDeleteTreeItem)
to your message map. Finally, add the handler to your .cpp file:
void CMyClass::OnDeleteTreeItem(NMHDR *pNMHDR, LRESULT *pResult)
{
NMTREEVIEW *pTreeNotify = (NMTREEVIEW *)pNMHDR;// Now pTreeNotify->itemOld.hItem is the HTREEITEM of the deleted tree item
}As to what you do in the handler, that's up to you... ------------------------ Derek Waters derek@lj-oz.com