#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    2
    Rep Power
    0

    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. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    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?
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    2
    Rep Power
    0
    yes thanks !!

    my problem is that i don't know the value of differents flags i need. but i'm going to search !!!
  6. #4
  7. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    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.

IMN logo majestic logo threadwatch logo seochat tools logo