你的位置:首页 > ASP.net教程

[ASP.net教程]SendMessage wMsg常量值参考


 1 namespace Core.WinAPI 2 { 3   /// <summary> 4   /// wMsg参数常量值: 5   /// </summary> 6   public static class Message 7   { 8     /// <summary> 9     /// WM_KEYDOWN 按下一个键 10     /// </summary> 11     public static int WM_KEYDOWN = 0x0100; 12  13     /// <summary> 14     /// 释放一个键 15     /// </summary> 16     public static int WM_KEYUP = 0x0101; 17  18     /// <summary> 19     /// 按下某键,并已发出WM_KEYDOWN, WM_KEYUP消息 20     /// </summary> 21     public static int WM_CHAR = 0x102; 22  23     /// <summary> 24     /// 当用translatemessage函数翻译WM_KEYUP消息时发送此消息给拥有焦点的窗口 25     /// </summary> 26     public static int WM_DEADCHAR = 0x103; 27  28     /// <summary> 29     /// 当用户按住ALT键同时按下其它键时提交此消息给拥有焦点的窗口 30     /// </summary> 31     public static int WM_SYSKEYDOWN = 0x104; 32  33     /// <summary> 34     /// 当用户释放一个键同时ALT 键还按着时提交此消息给拥有焦点的窗口 35     /// </summary> 36     public static int WM_SYSKEYUP = 0x105; 37  38     /// <summary> 39     /// 当WM_SYSKEYDOWN消息被TRANSLATEMESSAGE函数翻译后提交此消息给拥有焦点的窗口 40     /// </summary> 41     public static int WM_SYSCHAR = 0x106; 42  43     /// <summary> 44     /// 当WM_SYSKEYDOWN消息被TRANSLATEMESSAGE函数翻译后发送此消息给拥有焦点的窗口 45     /// </summary> 46     public static int WM_SYSDEADCHAR = 0x107; 47  48     /// <summary> 49     /// 在一个对话框程序被显示前发送此消息给它,通常用此消息初始化控件和执行其它任务 50     /// </summary> 51     public static int WM_INITDIALOG = 0x110; 52  53     /// <summary> 54     /// 当用户选择一条菜单命令项或当某个控件发送一条消息给它的父窗口,一个快捷键被翻译 55     /// </summary> 56     public static int WM_COMMAND = 0x111; 57  58     /// <summary> 59     /// 当用户选择窗口菜单的一条命令或//当用户选择最大化或最小化时那个窗口会收到此消息 60     /// </summary> 61     public static int WM_SYSCOMMAND = 0x112; 62  63     /// <summary> 64     /// 发生了定时器事件 65     /// </summary> 66     public static int WM_TIMER = 0x113; 67  68     /// <summary> 69     /// 当一个窗口标准水平滚动条产生一个滚动事件时发送此消息给那个窗口,也发送给拥有它的控件 70     /// </summary> 71     public static int WM_HSCROLL = 0x114; 72  73     /// <summary> 74     /// 当一个窗口标准垂直滚动条产生一个滚动事件时发送此消息给那个窗口也,发送给拥有它的控件 75     /// </summary> 76     public static int WM_VSCROLL = 0x115; 77  78     /// <summary> 79     /// 当一个菜单将要被激活时发送此消息,它发生在用户菜单条中的某项或按下某个菜单键,它允许程序在显示前更改菜单 80     /// </summary> 81     public static int WM_INITMENU = 0x116; 82  83     /// <summary> 84     /// 当一个下拉菜单或子菜单将要被激活时发送此消息,它允许程序在它显示前更改菜单,而不要改变全部 85     /// </summary> 86     public static int WM_INITMENUPOPUP = 0x117; 87  88     /// <summary> 89     /// 当用户选择一条菜单项时发送此消息给菜单的所有者(一般是窗口) 90     /// </summary> 91     public static int WM_MENUSELECT = 0x11F; 92  93     /// <summary> 94     /// 当菜单已被激活用户按下了某个键(不同于加速键),发送此消息给菜单的所有者 95     /// </summary> 96     public static int WM_MENUCHAR = 0x120; 97  98     /// <summary> 99     /// 当一个模态对话框或菜单进入空载状态时发送此消息给它的所有者,一个模态对话框或菜单进入空载状态100     /// 就是在处理完一条或几条先前的消息后没有消息它的列队中等待101     /// </summary>102     public static int WM_ENTERIDLE = 0x121;103 104     /// <summary>105     /// 在windows绘制消息框前发送此消息给消息框的所有者窗口,通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置消息框的文本和背景颜色106     /// </summary>107     public static int WM_CTLCOLORMSGBOX = 0x132;108 109     /// <summary>110     /// 当一个编辑型控件将要被绘制时发送此消息给它的父窗口通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置编辑框的文本和背景颜色111     /// </summary>112     public static int WM_CTLCOLOREDIT = 0x133;113 114     /// <summary>115     /// 当一个列表框控件将要被绘制前发送此消息给它的父窗口通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置列表框的文本和背景颜色116     /// </summary>117     public static int WM_CTLCOLORLISTBOX = 0x134;118 119     /// <summary>120     /// 当一个按钮控件将要被绘制时发送此消息给它的父窗口通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置按纽的文本和背景颜色121     /// </summary>122     public static int WM_CTLCOLORBTN = 0x135;123 124     /// <summary>125     /// 当一个对话框控件将要被绘制前发送此消息给它的父窗口通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置对话框的文本背景颜色126     /// </summary>127     public static int WM_CTLCOLORDLG = 0x136;128 129     /// <summary>130     /// 当一个滚动条控件将要被绘制时发送此消息给它的父窗口通过响应这条消息,所有者窗口可以通过使用给定的相关显示设备的句柄来设置滚动条的背景颜色131     /// </summary>132     public static int WM_CTLCOLORSCROLLBAR = 0x137;133 134     /// <summary>135     /// 当一个静态控件将要被绘制时发送此消息给它的父窗口通过响应这条消息,所有者窗口可以 通过使用给定的相关显示设备的句柄来设置静态控件的文本和背景颜色136     /// </summary>137     public static int WM_CTLCOLORSTATIC = 0x138;138 139     /// <summary>140     /// 当鼠标轮子转动时发送此消息个当前有焦点的控件141     /// </summary>142     public static int WM_MOUSEWHEEL = 0x20A;143 144     /// <summary>145     /// 双击鼠标中键146     /// </summary>147     public static int WM_MBUTTONDBLCLK = 0x209;148 149     /// <summary>150     /// 释放鼠标中键151     /// </summary>152     public static int WM_MBUTTONUP = 0x208;153 154     /// <summary>155     /// .移动鼠标时发生,同WM_MOUSEFIRST156     /// </summary>157     public static int WM_MOUSEMOVE = 0x200;158 159     /// <summary>160     /// 按下鼠标左键161     /// </summary>162     public static int WM_LBUTTONDOWN = 0x201;163 164     /// <summary>165     /// 释放鼠标左键166     /// </summary>167     public static int WM_LBUTTONUP = 0x202;168 169     /// <summary>170     /// 双击鼠标左键171     /// </summary>172     public static int WM_LBUTTONDBLCLK = 0x203;173 174     /// <summary>175     /// 按下鼠标右键176     /// </summary>177     public static int WM_RBUTTONDOWN = 0x204;178 179     /// <summary>180     /// 释放鼠标右键181     /// </summary>182     public static int WM_RBUTTONUP = 0x205;183 184     /// <summary>185     /// 双击鼠标右键186     /// </summary>187     public static int WM_RBUTTONDBLCLK = 0x206;188 189     //按下鼠标中键190     public static int WM_MBUTTONDOWN = 0x207;191 192     public static int WM_USER = 0x0400;193 194     public static int MK_LBUTTON = 0x0001;195 196     public static int MK_RBUTTON = 0x0002;197 198     public static int MK_SHIFT = 0x0004;199 200     public static int MK_CONTROL = 0x0008;201 202     public static int MK_MBUTTON = 0x0010;203 204     public static int MK_XBUTTON1 = 0x0020;205 206     public static int MK_XBUTTON2 = 0x0040;207 208     /// <summary>209     /// 创建一个窗口210     /// </summary>211     public static int WM_CREATE = 0x01;212 213     /// <summary>214     /// 当一个窗口被破坏时发送215     /// </summary>216     public static int WM_DESTROY = 0x02;217 218     /// <summary>219     /// 移动一个窗口220     /// </summary>221     public static int WM_MOVE = 0x03;222 223     /// <summary>224     /// 改变一个窗口的大小225     /// </summary>226     public static int WM_SIZE = 0x05;227 228     /// <summary>229     /// 一个窗口被激活或失去激活状态230     /// </summary>231     public static int WM_ACTIVATE = 0x06;232 233     /// <summary>234     /// 一个窗口获得焦点235     /// </summary>236     public static int WM_SETFOCUS = 0x07;237 238     /// <summary>239     /// 一个窗口失去焦点240     /// </summary>241     public static int WM_KILLFOCUS = 0x08;242 243     /// <summary>244     /// 一个窗口改变成Enable状态245     /// </summary>246     public static int WM_ENABLE = 0x0A;247 248     /// <summary>249     /// 设置窗口是否能重画250     /// </summary>251     public static int WM_SETREDRAW = 0x0B;252 253     /// <summary>254     /// 应用程序发送此消息来设置一个窗口的文本255     /// </summary>256     public static int WM_SETTEXT = 0x0C;257 258     /// <summary>259     /// 应用程序发送此消息来复制对应窗口的文本到缓冲区260     /// </summary>261     public static int WM_GETTEXT = 0x0D;262 263     /// <summary>264     /// 得到与一个窗口有关的文本的长度(不包含空字符)265     /// </summary>266     public static int WM_GETTEXTLENGTH = 0x0E;267 268     /// <summary>269     /// 要求一个窗口重画自己270     /// </summary>271     public static int WM_PAINT = 0x0F;272 273     /// <summary>274     /// 当一个窗口或应用程序要关闭时发送一个信号275     /// </summary>276     public static int WM_CLOSE = 0x10;277 278     /// <summary>279     /// 当用户选择结束对话框或程序自己调用ExitWindows函数280     /// </summary>281     public static int WM_QUERYENDSESSION = 0x11;282 283     /// <summary>284     /// 用来结束程序运行285     /// </summary>286     public static int WM_QUIT = 0x12;287 288     /// <summary>289     /// 当用户窗口恢复以前的大小位置时,把此消息发送给某个图标290     /// </summary>291     public static int WM_QUERYOPEN = 0x13;292 293     /// <summary>294     /// 当窗口背景必须被擦除时(例在窗口改变大小时)295     /// </summary>296     public static int WM_ERASEBKGND = 0x14;297 298     /// <summary>299     /// 当系统颜色改变时,发送此消息给所有顶级窗口300     /// </summary>301     public static int WM_SYSCOLORCHANGE = 0x15;302 303     /// <summary>304     /// 当系统进程发出WM_QUERYENDSESSION消息后,此消息发送给应用程序,通知它对话是否结束305     /// </summary>306     public static int WM_ENDSESSION = 0x16;307 308     /// <summary>309     /// 当隐藏或显示窗口是发送此消息给这个窗口310     /// </summary>311     public static int WM_SHOWWINDOW = 0x18;312 313     /// <summary>314     /// 发此消息给应用程序哪个窗口是激活的,哪个是非激活的315     /// </summary>316     public static int WM_ACTIVATEAPP = 0x1C;317 318     /// <summary>319     /// 当系统的字体资源库变化时发送此消息给所有顶级窗口320     /// </summary>321     public static int WM_FONTCHANGE = 0x1D;322 323     /// <summary>324     /// 当系统的时间变化时发送此消息给所有顶级窗口325     /// </summary>326     public static int WM_TIMECHANGE = 0x1E;327 328     /// <summary>329     /// 发送此消息来取消某种正在进行的摸态(操作)330     /// </summary>331     public static int WM_CANCELMODE = 0x1F;332 333     /// <summary>334     /// 如果鼠标引起光标在某个窗口中移动且鼠标输入没有被捕获时,就发消息给某个窗口335     /// </summary>336     public static int WM_SETCURSOR = 0x20;337 338     /// <summary>339     /// 当光标在某个非激活的窗口中而用户正按着鼠标的某个键发送此消息给//当前窗口340     /// </summary>341     public static int WM_MOUSEACTIVATE = 0x21;342 343     /// <summary>344     /// 发送此消息给MDI子窗口//当用户点击此窗口的标题栏,或//当窗口被激活,移动,改变大小345     /// </summary>346     public static int WM_CHILDACTIVATE = 0x22;347 348     /// <summary>349     /// 此消息由基于计算机的训练程序发送,通过WH_JOURNALPALYBACK的hook程序分离出用户输入消息350     /// </summary>351     public static int WM_QUEUESYNC = 0x23;352 353     /// <summary>354     /// 此消息发送给窗口当它将要改变大小或位置355     /// </summary>356     public static int WM_GETMINMAXINFO = 0x24;357 358     /// <summary>359     /// 发送给最小化窗口当它图标将要被重画360     /// </summary>361     public static int WM_PAINTICON = 0x26;362 363     /// <summary>364     /// 此消息发送给某个最小化窗口,仅//当它在画图标前它的背景必须被重画365     /// </summary>366     public static int WM_ICONERASEBKGND = 0x27;367 368     /// <summary>369     /// 发送此消息给一个对话框程序去更改焦点位置370     /// </summary>371     public static int WM_NEXTDLGCTL = 0x28;372 373     /// <summary>374     /// 每当打印管理列队增加或减少一条作业时发出此消息375     /// </summary>376     public static int WM_SPOOLERSTATUS = 0x2A;377 378     /// <summary>379     /// 当button,combobox,listbox,menu的可视外观改变时发送380     /// </summary>381     public static int WM_DRAWITEM = 0x2B;382 383     /// <summary>384     /// 当button, combo box, list box, list view control, or menu item 被创建时385     /// </summary>386     public static int WM_MEASUREITEM = 0x2C;387 388     /// <summary>389     /// 此消息有一个LBS_WANTKEYBOARDINPUT风格的发出给它的所有者来响应WM_KEYDOWN消息390     /// </summary>391     public static int WM_VKEYTOITEM = 0x2E;392 393     /// <summary>394     /// 此消息由一个LBS_WANTKEYBOARDINPUT风格的列表框发送给他的所有者来响应WM_CHAR消息395     /// </summary>396     public static int WM_CHARTOITEM = 0x2F;397 398     /// <summary>399     /// 当绘制文本时程序发送此消息得到控件要用的颜色400     /// </summary>401     public static int WM_SETFONT = 0x30;402 403     /// <summary>404     /// 应用程序发送此消息得到当前控件绘制文本的字体405     /// </summary>406     public static int WM_GETFONT = 0x31;407 408     /// <summary>409     /// 应用程序发送此消息让一个窗口与一个热键相关连410     /// </summary>411     public static int WM_SETHOTKEY = 0x32;412 413     /// <summary>414     /// 应用程序发送此消息来判断热键与某个窗口是否有关联415     /// </summary>416     public static int WM_GETHOTKEY = 0x33;417 418     /// <summary>419     /// 此消息发送给最小化窗口,当此窗口将要被拖放而它的类中没有定义图标,应用程序能返回一个图标或光标的句柄,当用户拖放图标时系统显示这个图标或光标420     /// </summary>421     public static int WM_QUERYDRAGICON = 0x37;422 423     /// <summary>424     /// 发送此消息来判定combobox或listbox新增加的项的相对位置425     /// </summary>426     public static int WM_COMPAREITEM = 0x39;427 428     /// <summary>429     /// 显示内存已经很少了430     /// </summary>431     public static int WM_COMPACTING = 0x41;432 433     /// <summary>434     /// 发送此消息给那个窗口的大小和位置将要被改变时,来调用setwindowpos函数或其它窗口管理函数435     /// </summary>436     public static int WM_WINDOWPOSCHANGING = 0x46;437 438     /// <summary>439     /// 发送此消息给那个窗口的大小和位置已经被改变时,来调用setwindowpos函数或其它窗口管理函数440     /// </summary>441     public static int WM_WINDOWPOSCHANGED = 0x47;442 443     /// <summary>444     /// 当系统将要进入暂停状态时发送此消息445     /// </summary>446     public static int WM_POWER = 0x48;447 448     /// <summary>449     /// 当一个应用程序传递数据给另一个应用程序时发送此消息450     /// </summary>451     public static int WM_COPYDATA = 0x4A;452 453     /// <summary>454     /// 当某个用户取消程序日志激活状态,提交此消息给程序455     /// </summary>456     public static int WM_CANCELJOURNA = 0x4B;457 458     /// <summary>459     /// 当某个控件的某个事件已经发生或这个控件需要得到一些信息时,发送此消息给它的父窗口460     /// </summary>461     public static int WM_NOTIFY = 0x4E;462 463     /// <summary>464     /// 当用户选择某种输入语言,或输入语言的热键改变465     /// </summary>466     public static int WM_INPUTLANGCHANGEREQUEST = 0x50;467 468     /// <summary>469     /// 当平台现场已经被改变后发送此消息给受影响的最顶级窗口470     /// </summary>471     public static int WM_INPUTLANGCHANGE = 0x51;472 473     /// <summary>474     /// 当程序已经初始化windows帮助例程时发送此消息给应用程序475     /// </summary>476     public static int WM_TCARD = 0x52;477 478     /// <summary>479     /// 此消息显示用户按下了F1,如果某个菜单是激活的,就发送此消息个此窗口关联的菜单,否则就发送给有焦点的窗口,如果//当前都没有焦点,就把此消息发送给//当前激活的窗口480     /// </summary>481     public static int WM_HELP = 0x53;482 483     /// <summary>484     /// 当用户已经登入或退出后发送此消息给所有的窗口,//当用户登入或退出时系统更新用户的具体设置信息,在用户更新设置时系统马上发送此消息485     /// </summary>486     public static int WM_USERCHANGED = 0x54;487 488     /// <summary>489     /// 公用控件,自定义控件和他们的父窗口通过此消息来判断控件是使用ANSI还是UNICODE结构490     /// </summary>491     public static int WM_NOTIFYFORMAT = 0x55;492 493     /// <summary>494     /// 当用户某个窗口中点击了一下右键就发送此消息给这个窗口495     /// </summary>496     //public static int WM_CONTEXTMENU = ??;497 498     /// <summary>499     /// 当调用SETWINDOWLONG函数将要改变一个或多个 窗口的风格时发送此消息给那个窗口500     /// </summary>501     public static int WM_STYLECHANGING = 0x7C;502 503     /// <summary>504     /// 当调用SETWINDOWLONG函数一个或多个 窗口的风格后发送此消息给那个窗口505     /// </summary>506     public static int WM_STYLECHANGED = 0x7D;507 508     /// <summary>509     /// 当显示器的分辨率改变后发送此消息给所有的窗口510     /// </summary>511     public static int WM_DISPLAYCHANGE = 0x7E;512 513     /// <summary>514     /// 此消息发送给某个窗口来返回与某个窗口有关连的大图标或小图标的句柄515     /// </summary>516     public static int WM_GETICON = 0x7F;517 518 519     //窗口关联520     /// <summary>521     /// 程序发送此消息让一个新的大图标或小图标与某个522     /// </summary>523     public static int WM_SETICON = 0x80;524 525     /// <summary>526     /// 当某个窗口第一次被创建时,此消息在WM_CREATE消息发送前发送527     /// </summary>528     public static int WM_NCCREATE = 0x81;529 530     /// <summary>531     /// 此消息通知某个窗口,非客户区正在销毁532     /// </summary>533     public static int WM_NCDESTROY = 0x82;534 535     /// <summary>536     /// 当某个窗口的客户区域必须被核算时发送此消息537     /// </summary>538     public static int WM_NCCALCSIZE = 0x83;539 540     /// <summary>541     /// 移动鼠标,按住或释放鼠标时发生542     /// </summary>543     public static int WM_NCHITTEST = 0x84;544 545     /// <summary>546     /// 程序发送此消息给某个窗口当它(窗口)的框架必须被绘制时547     /// </summary>548     public static int WM_NCPAINT = 0x85;549 550     /// <summary>551     /// 此消息发送给某个窗口仅当它的非客户区需要被改变来显示是激活还是非激活状态552     /// </summary>553     public static int WM_NCACTIVATE = 0x86;554 555     /// <summary>556     /// 发送此消息给某个与对话框程序关联的控件,widdows控制方位键和TAB键使输入进入此控件通过应557     /// </summary>558     public static int WM_GETDLGCODE = 0x87;559 560     /// <summary>561     /// 当光标在一个窗口的非客户区内移动时发送此消息给这个窗口 非客户区为:窗体的标题栏及窗 的边框体562     /// </summary>563     public static int WM_NCMOUSEMOVE = 0xA0;564 565     /// <summary>566     /// 当光标在一个窗口的非客户区同时按下鼠标左键时提交此消息567     /// </summary>568     public static int WM_NCLBUTTONDOWN = 0xA1;569 570     /// <summary>571     /// 当用户释放鼠标左键同时光标某个窗口在非客户区十发送此消息572     /// </summary>573     public static int WM_NCLBUTTONUP = 0xA2;574 575     /// <summary>576     /// 当用户双击鼠标左键同时光标某个窗口在非客户区十发送此消息577     /// </summary>578     public static int WM_NCLBUTTONDBLCLK = 0xA3;579 580     /// <summary>581     /// 当用户按下鼠标右键同时光标又在窗口的非客户区时发送此消息582     /// </summary>583     public static int WM_NCRBUTTONDOWN = 0xA4;584 585     /// <summary>586     /// 当用户释放鼠标右键同时光标又在窗口的非客户区时发送此消息587     /// </summary>588     public static int WM_NCRBUTTONUP = 0xA5;589 590     /// <summary>591     /// 当用户双击鼠标右键同时光标某个窗口在非客户区十发送此消息592     /// </summary>593     public static int WM_NCRBUTTONDBLCLK = 0xA6;594 595     /// <summary>596     /// 当用户按下鼠标中键同时光标又在窗口的非客户区时发送此消息597     /// </summary>598     public static int WM_NCMBUTTONDOWN = 0xA7;599 600     /// <summary>601     /// 当用户释放鼠标中键同时光标又在窗口的非客户区时发送此消息602     /// </summary>603     public static int WM_NCMBUTTONUP = 0xA8;604 605     /// <summary>606     /// 当用户双击鼠标中键同时光标又在窗口的非客户区时发送此消息607     /// </summary>608     public static int WM_NCMBUTTONDBLCLK = 0xA9;609 610     [DllImport("user32.dll")]611     public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);612 613     //此处主要用来让窗口置于最前(SetWindowPos(this.Handle,-1,0,0,0,0,0x4000|0x0001|0x0002);)614     [System.Runtime.InteropServices.DllImport("user32.dll")]615     public static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, int uFlags);616   }617 }