|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
Dword ???!!!!!!!!!!
hi !
a dword contain a flag .... i don't know read this flag because, i can only read an unsigned int ... can you help me ??? |
|
#2
|
||||
|
||||
|
I don't quite understand your question.
In Windows programming, DWORD is an unsigned long, an unsigned 32-bit integer. But you are saying that it contains a flag. OK, sometimes in a BYTE, UINT (unsigned int, 16 bits), or even a DWORD individual bits can serve as binary flags that are either set to 1 (true) or reset to 0 (false). Which bit is the flag? Or does it have a predefined constant value, like 0x00000020L, though you only know it by its name, like SOME_FLAG? In that case, AND the flag value to the DWORD. If the flag is reset to 0, then a zero value will be returned. But if the flag is set to 1, then a non-zero value will be returned (which BTW will be the same value as the flag value). So: Code:
if (the_dword & SOME_FLAG) // and the DWORD and the flag constant, non-zero is true
{
// do the processing for the flag having been set to true
}
else
{
// do the processing for the flag having been reset to false
}
Did that answer your question? |
|
#3
|
|||
|
|||
|
yes thanks !!
my problem is that i don't know the value of differents flags i need. but i'm going to search !!! |
|
#4
|
||||
|
||||
|
Usually, the header file contains #define statements which define the values for the flags and other constants and give them names (in all caps by convention). Then all you have to do is use the name; you don't need to know what the actual value is.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Dword ???!!!!!!!!!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|