What is a HTREEITEM?

2019-07-10 06:53发布

I am trying to debug some Tree View code, and I want to check that the HTREEITEM returned by CTreeCtrl.InsertItem is valid in memory.

However I cannot find any documentation for HTREEITEM in any of the places I usually check (Google, MSDN, Coworkers), only a whole bunch of people asking the same question.

Do you know what HTREEITEM is defined as? Do you know any good links that detail the internal structure of a HTREEITEM?

I am working in C++, but C references would also be helpful.

标签: c++ mfc
1条回答
成全新的幸福
2楼-- · 2019-07-10 07:46

It's just an opaque handle to a tree item in the default Tree View controls on Windows. You can acquire handles using e.g. TVM_INSERTITEM, they are used in other functions then for referencing the items.

The handle is defined in CommCtrl.h (part of the Windows SDK) like this:

struct _TREEITEM;
typedef struct _TREEITEM *HTREEITEM;

This is also the essence of an opaque handle: you only know that it references some data (a struct, in this case) but you don't know the definition of the data.

查看更多
登录 后发表回答