Constants question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DaveL

    Constants question

    In C# 2.0 or better
    What is the Best Way to Define Windows System Constants
    WM_COMMAND, BN_CLICKED, etc

    Should i use a Static Class
    namespace WinConstants
    {
    static class Users
    {
    public const int WM_COMMAND = 0x0111;
    }

    }

    or is there a Better Way now some constants change based on WINVER

    Im not Sure how to handle this Situation
    'in the vc Commctl.h Button Msgs change based
    on the WinVer
    From VC. vs studio 8 winusers.h


    #define BN_CLICKED 0
    #define BN_PAINT 1
    #define BN_HILITE 2
    #define BN_UNHILITE 3
    #define BN_DISABLE 4
    #define BN_DOUBLECLICKE D 5
    #if(WINVER >= 0x0400)
    #define BN_PUSHED BN_HILITE
    #define BN_UNPUSHED BN_UNHILITE
    #define BN_DBLCLK BN_DOUBLECLICKE D
    #define BN_SETFOCUS 6
    #define BN_KILLFOCUS 7
    #endif /* WINVER >= 0x0400 */



  • puzzlecracker

    #2
    Re: Constants question

    On Oct 14, 2:57 pm, "DaveL" <dvs_...@sbcglo bal.netwrote:
    In C# 2.0 or better
    What is the Best Way to Define Windows System Constants
    WM_COMMAND, BN_CLICKED, etc
    >
    Should i  use a Static Class
    namespace WinConstants
    {
    static class Users
    {
      public const int WM_COMMAND = 0x0111;
    >
    }
    }
    >
    or is there a Better Way now some constants change based on WINVER
    >
    Im not Sure how to handle this Situation
    'in the vc Commctl.h  Button Msgs change based
    on the WinVer
    From VC. vs studio 8 winusers.h
    >
    #define BN_CLICKED          0
    #define BN_PAINT            1
    #define BN_HILITE           2
    #define BN_UNHILITE         3
    #define BN_DISABLE          4
    #define BN_DOUBLECLICKE D    5
    #if(WINVER >= 0x0400)
    #define BN_PUSHED           BN_HILITE
    #define BN_UNPUSHED         BN_UNHILITE
    #define BN_DBLCLK           BN_DOUBLECLICKE D
    #define BN_SETFOCUS         6
    #define BN_KILLFOCUS        7
    #endif /* WINVER >= 0x0400 */
    maybe enum ???

    Comment

    • Jeff Johnson

      #3
      Re: Constants question

      "DaveL" <dvs_bis@sbcglo bal.netwrote in message
      news:mY5Jk.4914 $be.149@nlpi061 .nbdc.sbc.com.. .
      In C# 2.0 or better
      What is the Best Way to Define Windows System Constants
      WM_COMMAND, BN_CLICKED, etc
      >
      Should i use a Static Class
      namespace WinConstants
      {
      static class Users
      {
      public const int WM_COMMAND = 0x0111;
      }
      >
      }
      From VC. vs studio 8 winusers.h
      Sounds good, except for one picky thing: it's winuser.h, not winuserS.h, so
      don't call it Users, call it User.


      Comment

      • DaveL

        #4
        Re: Constants question

        namespace winconstants
        {
        public static class WinUser
        {
        }
        public static class CommCtl
        {
        {
        }
        and so forth

        the actual class is WinUuser

        i flubbed up posting it here
        sorry
        DaveL


        "Jeff Johnson" <i.get@enough.s pamwrote in message
        news:e09h03jLJH A.5232@TK2MSFTN GP02.phx.gbl...
        "DaveL" <dvs_bis@sbcglo bal.netwrote in message
        news:mY5Jk.4914 $be.149@nlpi061 .nbdc.sbc.com.. .
        >
        >In C# 2.0 or better
        >What is the Best Way to Define Windows System Constants
        >WM_COMMAND, BN_CLICKED, etc
        >>
        >Should i use a Static Class
        >namespace WinConstants
        >{
        >static class Users
        >{
        > public const int WM_COMMAND = 0x0111;
        >}
        >>
        >}
        >
        >From VC. vs studio 8 winusers.h
        >
        Sounds good, except for one picky thing: it's winuser.h, not winuserS.h,
        so don't call it Users, call it User.
        >

        Comment

        Working...