Constants question

D

DaveL

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_DOUBLECLICKED 5
#if(WINVER >= 0x0400)
#define BN_PUSHED BN_HILITE
#define BN_UNPUSHED BN_UNHILITE
#define BN_DBLCLK BN_DOUBLECLICKED
#define BN_SETFOCUS 6
#define BN_KILLFOCUS 7
#endif /* WINVER >= 0x0400 */
 
P

puzzlecracker

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_DOUBLECLICKED    5
#if(WINVER >= 0x0400)
#define BN_PUSHED           BN_HILITE
#define BN_UNPUSHED         BN_UNHILITE
#define BN_DBLCLK           BN_DOUBLECLICKED
#define BN_SETFOCUS         6
#define BN_KILLFOCUS        7
#endif /* WINVER >= 0x0400 */

maybe enum ???
 
J

Jeff Johnson

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.
 
Top