Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to use function "OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult) " on ctreectrl?

How to use function "OnDeleteitem(NMHDR* pNMHDR, LRESULT* pResult) " on ctreectrl?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Feng Qin
    wrote on last edited by
    #1

    as title I'm amumu, and you?

    D 1 Reply Last reply
    0
    • F Feng Qin

      as title I'm amumu, and you?

      D Offline
      D Offline
      Derek Waters
      wrote on last edited by
      #2

      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

      F 1 Reply Last reply
      0
      • D Derek Waters

        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

        F Offline
        F Offline
        Feng Qin
        wrote on last edited by
        #3

        Thanks, I got it:) I'm amumu, and you?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups