I didn't find any namespace for some Windows constants when I working in .NET
CF and C# (e.g. WM_PAINT or any other message constants).
I can use direct values of these message-constants but I don't like use any
"magic number" in my source codes.
It would be better if I used a namespace-constant (e.g.
System.Windows.Forms.MessageValue.WM_PAINT or somethink like this).
I can create this namespace but I think that it should exists in .NET
Compact Framework library.
Using values from standard windows.h (winuser.h) header file can make a
mistake because some constants in CE differ from constants in other
Windows versions (e.g. see WH_KEYBOARD_LL windows hook message).
The questions are:
1. Are there any namespaces to enumerate these constant values?
2. If not, how can I find a correct values for Windows messages instead of
using "magic numbers"?

LPeter

Re: Message constant values or magic numbers? (C#) by Chris

Chris
Wed Mar 12 09:36:28 CDT 2008

> 1. Are there any namespaces to enumerate these constant values?

No, there aren't any.

> 2. If not, how can I find a correct values for Windows messages instead of
> using "magic numbers"?

Look them up in the SDK headers. winuser.h is the most common. There's no
way to "query" them, you have to hard code them in.

-Chris



Re: Message constant values or magic numbers? (C#) by LPeter

LPeter
Wed Mar 12 09:49:01 CDT 2008



That's exactly what I feared...
Thank you for the header file info.

Bye



"Chris Tacke, eMVP" wrote:

> > 1. Are there any namespaces to enumerate these constant values?
>
> No, there aren't any.
>
> > 2. If not, how can I find a correct values for Windows messages instead of
> > using "magic numbers"?
>
> Look them up in the SDK headers. winuser.h is the most common. There's no
> way to "query" them, you have to hard code them in.
>
> -Chris
>