|
-
Dec 12th, 2002, 03:17 AM
#1
Thread Starter
Lively Member
A question about bit masks
What I'm ultimately attempting to do is determine if a box is checked in an a tree view. I was using something to the effect of
Code:
if (tvi.state == INDEXTOSTATEIMAGEMASK(2))
But that doesn't work if it has any other properties, like children items because it has flags determining weather it's expanded and so on. So how can I just compare "bits 12-15" as that's what MSDN says determines the state image.
-
Dec 12th, 2002, 07:10 AM
#2
Try
Code:
if ((tvi.state & INDEXTOSTATEIMAGEMASK(2))== INDEXTOSTATEIMAGEMASK(2))
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Dec 12th, 2002, 10:12 AM
#3
Frenzied Member
And a value with a known bitmask: it sets bits on only if the bits are both 1's in both operands. You should end up with the result equalling the original bit mask -
Just like crtptctctc..etc showed you. If I had a name like that I think I'd like 'Joe' better - it's easier to spell.
If you code in C or C++ you have to know about &, |, ^, <<, >>
and exactly what they do.
-
Dec 12th, 2002, 11:09 AM
#4
Why is crptcblade hard to spell?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 12th, 2002, 09:40 PM
#5
Thread Starter
Lively Member
Crtpcblade, thanks that worked perfectly
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|