Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a HTREEITEM?

Tags:

c++

mfc

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.

like image 332
sji Avatar asked Oct 23 '25 19:10

sji


1 Answers

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.

like image 188
Frerich Raabe Avatar answered Oct 26 '25 10:10

Frerich Raabe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!