• Advertisement


This topic is now archived and is closed to further replies.

Getting information from DWORD ?

This topic is 5437 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! Could someone explain to me how the DWORD variables work? I see they are used very much. What I wonder the most is how to "extract" a value from a DWORD variable. Lets say that I have this code: DWORD check = (SOMETHING1 | SOMETHING2); Then I would like to get the SOMETHING2 value from the check. How would this be done? Something like this: DWORD check2 = //here I want the SOMETHING2 value. I would also like to ask how I would add a value to a DWORD variable? Something like this: DWORD check = (SOMETHING1 | SOMETHING2); //Now I want to add SOMETHING3 to the check variable Thank you!

Share this post

Link to post
Share on other sites

#define SOMETHING1 0x00000001
#define SOMETHING2 0x00000002
#define SOMETHING3 0x00000004
#define SOMETHING4 0x00000008
#define SOMETHING5 0x0000000F
#define SOMETHING6 0x00000010
#define SOMETHING7 0x00000020
#define SOMETHING8 0x00000040
#define SOMETHING9 0x00000080
#define SOMETHING10 0x000000F0
#define SOMETHING11 0x00000100 // up to SOMETHING32


if(flags & SOMETHING1)
// something1 is set
if(flags & SOMETHING2)
// something2 is set

Share this post

Link to post
Share on other sites

  • Advertisement