Public Group

#### Archived

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

# Getting information from DWORD ?

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

## 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 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

DWORD flags = SOMETHING1 | SOMETHING5 | SOMETHING10;

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

##### Share on other sites
Thank you very much!

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5

• 13
• 19
• 14
• 9
• 9
• ### Forum Statistics

• Total Topics
632935
• Total Posts
3009304
• ### Who's Online (See full list)

There are no registered users currently online

×