CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: #define ?????

  1. #1
    Join Date
    Aug 2003
    Posts
    20

    #define ?????

    Hi there

    Can someone tell me What these code mean and why people want to write code like these?


    #define LVNI_ALL 0x0000
    #define LVNI_FOCUSED 0x0001
    #define LVNI_SELECTED 0x0002
    #define LVNI_CUT 0x0004

    I know that 0x0000, 0x0001, and 0x0002 are Hexadecimal, and those are 0,1,2 in decimal.

    Can I change those code to:
    #define LVNI_ALL 0
    #define LVNI_FOCUSED 1
    #define LVNI_SELECTED 2
    #define LVNI_CUT 4

    Thank for your help

  2. #2
    Join Date
    Sep 2002
    Posts
    924
    It is another way of making in alias so that you may use the decriptive text rather than it's numerical equivilant in your code.

  3. #3
    Join Date
    May 1999
    Location
    Houston, Texas
    Posts
    81

    Smile

    The reason it is in hex is an easy reminder that you are defining unique bits so you can use code like:

    if ( a | flag1 || a | flag2 )

    Notice that this is a bit wise or not the || operator.
    Who was that masked man?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured