April 26th, 2003, 01:47 PM
a dword contain a flag .... i don't know read this flag because, i can only read an unsigned int ...
can you help me ???
April 26th, 2003, 02:05 PM
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).
Did that answer your question?
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
// do the processing for the flag having been reset to false
April 26th, 2003, 02:24 PM
yes thanks !!
my problem is that i don't know the value of differents flags i need. but i'm going to search !!!
April 26th, 2003, 08:26 PM
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.