
April 26th, 2003, 02:05 PM
|
 |
Contributing User
|
|
Join Date: Jan 2003
Location: USA
|
|
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?
|