PC Review


Reply
Thread Tools Rate Thread

Constants question

 
 
DaveL
Guest
Posts: n/a
 
      14th Oct 2008
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 */



 
Reply With Quote
 
 
 
 
puzzlecracker
Guest
Posts: n/a
 
      14th Oct 2008
On Oct 14, 2:57*pm, "DaveL" <dvs_...@sbcglobal.net> wrote:
> 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 ???
 
Reply With Quote
 
Jeff Johnson
Guest
Posts: n/a
 
      14th Oct 2008
"DaveL" <(E-Mail Removed)> wrote in message
news:mY5Jk.4914$(E-Mail Removed)...

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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
design question about the use of constants and resource files gabriel Microsoft C# .NET 4 17th Oct 2005 08:52 PM
Question about VB constants turnerje Microsoft Excel Programming 2 4th Oct 2005 07:30 PM
Newbie question.. what does [somedata] represent? Constants?? =?Utf-8?B?QWxleCBXb2xmZg==?= Microsoft Excel Programming 1 11th Mar 2005 04:25 PM
C/VB to C# - newbie question about shared constants 13 Fallen Microsoft C# .NET 3 11th May 2004 01:45 PM
Question on constants Simon Harvey Microsoft C# .NET 6 27th Feb 2004 07:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:46 AM.