你可以从MSDN里找到相应的常量定义及结构定义,如果你安装了VC++那会更好,可以通过查找.H文件来找到定义。最简单的就是在IDE的文件查找里,输入常量名称,查找条件为.h来查找。
解决方案 »
- treeview click事件的一点小疑问
- DIY个GPS导航定位软件小工具。
- 正则问题.....请赐教.
- 如何获得BindingSource当前记录
- 请问谁有VS2003开发WINCE4的事例或资料,请发我一份[email protected],谢谢
- 在C#中如何将文件夹中的文件按照创建时间排序?
- 关于pocket pc 2003 SDK的安装问题
- C#中通过HttpWebRequest发送数据
- 菜鸟问题—————能不能对table执行sql语句
- 关于DataSet读取Xml文件,创建成Tables的问题!
- (急问)socket不断重连,会导致程序退出,请高手解答原因
- 求助,报了个异常“在结果列列表中多次出现列名 'D_StoneWeight'”
#define WM_SETFOCUS 0x0007
#define WM_KILLFOCUS 0x0008
#define WM_ENABLE 0x000A
#define WM_SETREDRAW 0x000B
#define WM_SETTEXT 0x000C
#define WM_GETTEXT 0x000D
#define WM_GETTEXTLENGTH 0x000E
#define WM_PAINT 0x000F
#define WM_CLOSE 0x0010
#ifndef _WIN32_WCE
#define WM_QUERYENDSESSION 0x0011
#define WM_QUERYOPEN 0x0013
#define WM_ENDSESSION 0x0016
#endif
#define WM_QUIT 0x0012
#define WM_ERASEBKGND 0x0014
#define WM_SYSCOLORCHANGE 0x0015
#define WM_SHOWWINDOW 0x0018
Oh! My God!但我在 WndProc 裡用 Debug.WriteLine(m.ToString()); 這樣把消息打印出來,也時輸出 WM_CLOSE 的字符串呢?我想在.net 內部應該是有定義的
我知道,我只是想確認一下,是不是 .net 裡沒有定義這些常量,是不是必須要手動加入
你看到的那些常量的名字只不过是在.net内部把其使用Switch做了个处理。
事实上.Net Framework在System.Windows.Forms中定义了windows的消息和结构体,在NativeMethods类中,但是由于其定义为"internal static class NativeMethods",因此无法在System.Windows.Forms外使用,如果你不想查看msdn,你可以通过反编译该程序集的方法,将其中的消息定义copy下来使用即可。如下是其中一部分:
public const int WH_GETMESSAGE = 3;
public const int WH_JOURNALPLAYBACK = 1;
public const int WH_MOUSE = 7;
public const int WHEEL_DELTA = 120;
public const int WINDING = 2;
public const int WM_ACTIVATE = 6;
public const int WM_ACTIVATEAPP = 0x1c;
public const int WM_AFXFIRST = 0x360;
public const int WM_AFXLAST = 0x37f;
public const int WM_APP = 0x8000;
public const int WM_ASKCBFORMATNAME = 780;
public const int WM_CANCELJOURNAL = 0x4b;
public const int WM_CANCELMODE = 0x1f;
public const int WM_CAPTURECHANGED = 0x215;
public const int WM_CHANGECBCHAIN = 0x30d;
public const int WM_CHANGEUISTATE = 0x127;
public const int WM_CHAR = 0x102;
public const int WM_CHARTOITEM = 0x2f;
public const int WM_CHILDACTIVATE = 0x22;
public const int WM_CHOOSEFONT_GETLOGFONT = 0x401;
public const int WM_CLEAR = 0x303;
public const int WM_CLOSE = 0x10;
public const int WM_COMMAND = 0x111;
public const int WM_COMMNOTIFY = 0x44;
public const int WM_COMPACTING = 0x41;
public const int WM_COMPAREITEM = 0x39;
public const int WM_CONTEXTMENU = 0x7b;
public const int WM_COPY = 0x301;
public const int WM_COPYDATA = 0x4a;
public const int WM_CREATE = 1;
public const int WM_CTLCOLOR = 0x19;
public const int WM_CTLCOLORBTN = 0x135;
public const int WM_CTLCOLORDLG = 310;
public const int WM_CTLCOLOREDIT = 0x133;
public const int WM_CTLCOLORLISTBOX = 0x134;
public const int WM_CTLCOLORMSGBOX = 0x132;
public const int WM_CTLCOLORSCROLLBAR = 0x137;
public const int WM_CTLCOLORSTATIC = 0x138;
public const int WM_CUT = 0x300;
public const int WM_DEADCHAR = 0x103;
public const int WM_DELETEITEM = 0x2d;
public const int WM_DESTROY = 2;
public const int WM_DESTROYCLIPBOARD = 0x307;
public const int WM_DEVICECHANGE = 0x219;
public const int WM_DEVMODECHANGE = 0x1b;
public const int WM_DISPLAYCHANGE = 0x7e;
public const int WM_DRAWCLIPBOARD = 0x308;
public const int WM_DRAWITEM = 0x2b;