Proper way to get item from CTreeCtrl

Hello,
  I have added items to a tree control. i record their identities by giving each one a special lParam. given this, how can i use "GetItem" to return the hItem, so I can delete it?

Thanks,
 jer
pipeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mikeblasCommented:
You can't do that: the tree control simply doesn't work that way.  GetItem() gets an item based on the hItem; it doesn't find an item matching the attributes you want to specify.

If you wanted, I guess you could write some recursive code to get each item using GetNextItem() and examine the lParam of every item in the control. But that would be terrible: performance would be miserable.

Instead, I think you should record their identities by building a list or array of the hItems you get back.  What's the "special value" you're storing?

..B ekiM
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pipeAuthor Commented:
yea, i fixed it. lot of work tho
0
mikeblasCommented:
> lot of work tho

Work is what you get paid for.

..B ekiM
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.