CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13
  1. #1
    Join Date
    Feb 2012
    Posts
    181

    Question How get string value of HTREEITEM?

    How get string value of HTREEITEM?

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: How get string value of HTREEITEM?

    Have you checked the documentation? There's a method with a really obvious name.

  3. #3
    Join Date
    Feb 2012
    Posts
    181

    Exclamation Re: How get string value of HTREEITEM?

    GCDEF,
    I had found GetItemText, but it range "Identifier not found".

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: How get string value of HTREEITEM?

    Quote Originally Posted by AKE View Post
    GCDEF,
    I had found GetItemText, but it range "Identifier not found".
    Then I guess you're not using it correctly.

  5. #5
    Join Date
    Feb 2012
    Posts
    181

    Re: How get string value of HTREEITEM?

    I must call it in CTreeView method...
    I tried such
    this->GetItemText(hItem)
    GetItemText(hItem)
    (descendant):
    CDirView->GetItemText(hItem)
    ((CTreeView *) this)-> GetItemText(hItem)

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: How get string value of HTREEITEM?

    Quote Originally Posted by AKE View Post
    I must call it in CTreeView method...
    I tried such
    this->GetItemText(hItem)
    GetItemText(hItem)
    (descendant):
    CDirView->GetItemText(hItem)
    ((CTreeView *) this)-> GetItemText(hItem)
    That one should work if you're calling it from your CTreeView derived class. Which class are you calling it from?

  7. #7
    Join Date
    Feb 2012
    Posts
    181

    Re: How get string value of HTREEITEM?

    class CDirView: public CTreeView
    ...
    void CDirView::OnItemExpanding1(NMHDR *pNMHDR, LRESULT* pResult)
    {
    NM_TREEVIEW *pNMTreeView = (NM_TREEVIEW *) pNMHDR;
    HTREEITEM hItem = pNMTreeView->itemNew.hItem;
    wchar_t *temp = GetItemText(hItem);
    }

  8. #8
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: How get string value of HTREEITEM?

    And what's the exact problem? Compile or runtime error?

  9. #9
    Join Date
    Feb 2012
    Posts
    181

    Exclamation Re: How get string value of HTREEITEM?

    GCDEF
    Compile error C3861: Identifier not found

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: How get string value of HTREEITEM?

    Quote Originally Posted by AKE View Post
    class CDirView: public CTreeView
    ...
    void CDirView::OnItemExpanding1(NMHDR *pNMHDR, LRESULT* pResult)
    {
    NM_TREEVIEW *pNMTreeView = (NM_TREEVIEW *) pNMHDR;
    HTREEITEM hItem = pNMTreeView->itemNew.hItem;
    wchar_t *temp = GetItemText(hItem);
    }
    it should be
    Code:
    CString  text = GetTreeCtrl().GetItemText(hItem);
    Victor Nijegorodov

  11. #11
    Join Date
    Feb 2012
    Posts
    181

    Exclamation Re: How get string value of HTREEITEM?

    VictorN, Thanks...

  12. #12
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: How get string value of HTREEITEM?

    Quote Originally Posted by AKE View Post
    VictorN, Thanks...
    I think I'm going to stop trying to help you.

  13. #13
    Join Date
    Feb 2012
    Posts
    181

    Re: How get string value of HTREEITEM?

    GCDEF, Sorry. You of couse help me too. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured