C#中如何截取Windows消息来触发自定义事件
在c#windows开发中,我们常常会遇到拦截windows消息,来触发某个特定任务的问题。
由于目前使用c#的开发人员非常多,而且大多数c#程序员都不是从Windwos c++转过来的对windows消息机制不怎么了解,遇到这类问题还是挺棘手的,我们公司有个同事问,就写这个小实例,帮助那些遇到此类问题的兄弟姐妹。
实现方式目前有两种:
1 使用Control类的虚方法WndProc来截取Windows消息
基类为Control类的所有控件都有一个protected virtual void WndProc(ref Message m) 的虚方法。我只要重载该虚方法,那么这个控件聚焦后就可以扑捉windows消息,并触发该方法了。
protected override void WndProc(ref Message m)
{
switch (m.Msg) //判断系统消息的ID号
{
case :
MessageBox.Show("恭喜你点击了左键!");
m.Result = (IntPtr); //为了响应消息处理而向 Windows 返回的值
break;
case :
MessageBox.Show("恭喜你点击了右键!");
m.Result = (IntPtr); //为了响应消息处理而向 Windows 返回的值
break;
default:
base.WndProc(ref m);
break;
}
}
2 通过实现IMessageFilter接口,来截取获Windows消息。
IMessageFilter接口用来定义消息筛选器接口,该接口的PreFilterMessage方法用来在调度消息之前将其筛选出来。他的实现如下:
public class MessageFilter : IMessageFilter
{
public bool PreFilterMessage(ref Message message) //实现PreFilterMessage方法
{
switch (message.Msg) //判断系统消息的ID号
{
case :
MessageBox.Show("恭喜你点击了左键!");
return true;
case :
MessageBox.Show("恭喜你点击了右键!");
return true;
default:
return false;
}
}
}
那么如何使用这个类? 其实在类Application中有个AddMessageFilter(IMessageFilter value)的静态方法,只要添加进去就可以,
例如:Application.AddMessageFilter(MessageFilter); 加进去可别忘了,加进去的消息过滤器也可删除Application。RemoveMessageFilter(IMessageFilter value);
附录: windows消息ID列表
( 备注地址为0x????格式,0x后仅四位,四位以后的为乱码,为本文格式排版问题,待完善 ):
WM_NULL=0x0000
WM_CREATE=0x0001
WM_DESTROY=0x0002
WM_MOVE=0x0003
WM_SIZE=0x0005
WM_ACTIVATE=0x0006
WM_GETTEXT=0x000D
WM_GETTEXTLENGTH=0x000E
WM_PAINT=0x000F
WM_CLOSE=0x0010
WM_QUERYENDSESSION=0x0011
WM_QUERYOPEN=0x0013
WM_ENDSESSION=0x0016
WM_QUIT=0x0012
WM_ERASEBKGND=0x0014
WM_SYSCOLORCHANGE=0x0015
WM_SHOWWINDOW=0x0018
WM_WININICHANGE=0x001A
WM_SETTINGCHANGE=0x001A
WM_ACTIVATEAPP=0x001C
WM_FONTCHANGE=0x001D
WM_TIMECHANGE=0x001E
WM_CANCELMODE=0x001F
WM_MOUSEACTIVATE=0x0021
WM_CHILDACTIVATE=0x0022
WM_QUEUESYNC=0x0023
WM_NEXTDLGCTL=0x0028
WM_SPOOLERSTATUS=0x002A
WM_DRAWITEM=0x002B
WM_MEASUREITEM=0x002C
WM_DELETEITEM=0x002D
WM_VKEYTOITEM=0x002E
WM_CHARTOITEM=0x002F
WM_SETFONT=0x0030
WM_GETFONT=0x0031
WM_SETHOTKEY=0x0032
WM_GETHOTKEY=0x0033
WM_QUERYDRAGICON=0x0037
WM_COMMNOTIFY=0x0044
WM_WINDOWPOSCHANGING=0x0046
WM_WINDOWPOSCHANGED=0x0047
WM_CANCELJOURNAL=0x004B
WM_NOTIFY=0x004E
WM_INPUTLANGCHANGEREQUEST=0x0050
WM_INPUTLANGCHANGE=0x0051
WM_TCARD=0x00528 i; {( h( Y* s' b
WM_HELP=0x00537 y3 p: J1 z+ e V% @)
F* |/ k6 {! e/ v3 o6 q" k. t
WM_CONTEXTMENU=0x007B- K6 ? j% J2 U* I7
n
WM_STYLECHANGING=0x007C4 l' C" ?! e9 i4
e
WM_STYLECHANGED=0x007D
WM_DISPLAYCHANGE=0x007E
WM_GETICON=0x007F J: _/ _.
O)
WM_GETDLGCODE=0x0087$ d% z% i* O4 _( g! q1
|
WM_SYNCPAINT=0x0088
WM_NCMOUSEMOVE=0x00A0
WM_NCLBUTTONDOWN=0x00A1
WM_NCLBUTTONUP=0x00A2
WM_NCLBUTTONDBLCLK=0x00A3
WM_NCRBUTTONDOWN=0x00A4
WM_NCRBUTTONUP=0x00A5% g3 K4 g6 B( c+ ^:
X
WM_NCRBUTTONDBLCLK=0x00A6
WM_NCMBUTTONDOWN=0x00A7
WM_NCMBUTTONUP=0x00A8, q# a7
x5 s& V2 {4 i
WM_NCMBUTTONDBLCLK=0x00A9, I" ^; L6 }6 c0 o- G"
P
WM_NCXBUTTONDOWN=0x00AB7 W3 E9 Z/ n/ {/
g, G* l; L2 Q6 O* F
WM_NCXBUTTONUP=0x00AC
WM_NCXBUTTONDBLCLK=0x00AD
WM_INPUT=0x00FF- }4 }5 Q; s+ ^:
U O' B
WM_KEYFIRST=0x0100
WM_KEYDOWN=0x01009 e+ z( O7 J8 b-
{* T( s
WM_KEYUP=0x01013 _+ g8 c)
G- T& }1 @# Q# f
WM_UNICHAR=0x0109
WM_KEYLAST_NT501=0x0109
UNICODE_NOCHAR=0xFFFF
WM_KEYLAST_PRE501=0x0108+ U; P$ I$ e$ R2 p8
w( ~
WM_IME_STARTCOMPOSITION=0x010D&
L1 V4 d3 P `8 r( o! ~* g
WM_IME_ENDCOMPOSITION=0x010E
WM_IME_COMPOSITION=0x010F
WM_IME_KEYLAST=0x010F1 W: [4 w. O;
i/ e
WM_INITDIALOG=0x0110
WM_COMMAND=0x0111
WM_SYSCOMMAND=0x01124 `2 Z8 p6 f. d$
T8 m
WM_TIMER=0x0113
WM_HSCROLL=0x0114 [6 L1 W. v6 O2
[ @5 U)
WM_MENUSELECT=0x011F
WM_MENUCHAR=0x0120"
Y& c8 q+ ~% y/ s5 Z9 e
WM_ENTERIDLE=0x0121
WM_MENURBUTTONUP=0x0122
WM_MENUDRAG=0x0123
WM_MENUGETOBJECT=0x0124
WM_UNINITMENUPOPUP=0x0125
WM_MENUCOMMAND=0x0126+ } {7 |" T2 m- N C5 ^$ a)
WM_CTLCOLOREDIT=0x0133% i/ _)
WM_CTLCOLORBTN=0x0135
WM_CTLCOLORDLG=0x01368 i* w0 g; |)
WM_MOUSEMOVE=0x0200, p4 s5 t8 J' C&
A( @' Y
WM_LBUTTONDOWN=0x0201% a' /7 k*
J1 H. N9 /7 [. r! O
WM_LBUTTONUP=0x0202& q& w- i7 e4 w" t5 p#
k
WM_LBUTTONDBLCLK=0x02038 o# y* H- E9
p
WM_RBUTTONDOWN=0x0204
WM_RBUTTONUP=0x02059 i% Q% O4 d4
S1 R
WM_RBUTTONDBLCLK=0x0206/ B% o' ~5 F'
M2 q, Q ~
WM_MBUTTONDOWN=0x02079 ^&
h9 {& A. E0 [6 l3 ^( s: [
WM_MBUTTONUP=0x02083 I* })
[' n- y6 h$ e# ]% |8 m
WM_XBUTTONDOWN=0x020B8 g% m h9 q2 E5 L
WM_XBUTTONUP=0x020C8 x; P2 {+ Z3
_
WM_XBUTTONDBLCLK=0x020D
WM_MOUSELAST_5=0x020D)
WM_SIZING=0x0214
WM_CAPTURECHANGED=0x0215! n* _0
D3 t7 _; D( }& F
WM_MOVING=0x0216; |'
Z7 p+ w; v9 ^" g; y
WM_POWERBROADCAST=0x0218/ o1 D)
WM_MDIACTIVATE=0x0222)
WM_MDINEXT=0x0224)
WM_MDICASCADE=0x0227
WM_MDIICONARRANGE=0x0228" a& w5 C @- t9 ?9 B!
x8
N
WM_MDIGETACTIVE=0x02293 o! h)
WM_DROPFILES=0x0233
WM_MDIREFRESHMENU=0x0234( ^2 }6 z1 k4
_
WM_IME_SETCONTEXT=0x0281
WM_IME_NOTIFY=0x0282
WM_IME_CONTROL=0x0283
WM_IME_COMPOSITIONFULL=0x0284' T7 I: G; N' S- R;
|
WM_IME_SELECT=0x0285
WM_IME_CHAR=0x0286
WM_IME_REQUEST=0x0288; n' J2 `% q! i4 w1
v$ M5 u
WM_IME_KEYDOWN=0x02906 w8 S( [8
` R$ y8 t: F$ E
WM_IME_KEYUP=0x0291# /"
s _/ G" i
WM_MOUSEHOVER=0x02A1
WM_MOUSELEAVE=0x02A3
WM_NCMOUSEHOVER=0x02A0
WM_NCMOUSELEAVE=0x02A2
WM_WTSSESSION_CHANGE=0x02B1
WM_TABLET_FIRST=0x02c0
WM_TABLET_LAST=0x02df
WM_CUT=0x0300
WM_COPY=0x0301: D: F9 J1 f, R: S6 W. U6 z*
j
WM_PASTE=0x0302
WM_CLEAR=0x03036 m3 e. /% Z2
e
WM_UNDO=0x03042 M' K& }( a: A1
T
WM_RENDERFORMAT=0x0305
WM_RENDERALLFORMATS=0x0306
WM_DESTROYCLIPBOARD=0x03078 ~, u! u% U*
O
WM_DRAWCLIPBOARD=0x0308 y" z b2 F/ m5
i' o# c8 r
WM_PAINTCLIPBOARD=0x0309"
z D; J& /# a; o- m1 k. H' ^
WM_VSCROLLCLIPBOARD=0x030A
WM_SIZECLIPBOARD=0x030B)
WM_HSCROLLCLIPBOARD=0x030E
WM_QUERYNEWPALETTE=0x030F% t1 b# M7 N5 D6
P
WM_PALETTEISCHANGING=0x0310
WM_PALETTECHANGED=0x0311+
V0 d$ [9 W8 K3 Y" w" _$ K! z
WM_HOTKEY=0x0312
WM_PRINT=0x0317
WM_PRINTCLIENT=0x0318: D: F& r9 }! x( ?, @"
e
WM_APPCOMMAND=0x0319
WM_THEMECHANGED=0x031A
WM_HANDHELDFIRST=0x0358
WM_HANDHELDLAST=0x035F$ Y9
s1 {* I- @8 k: n
WM_AFXFIRST=0x0360+ /"
d0 @! u ?. /)
WM_USER=0x04002 w( L7 d2 ^6 a0 m, p; m%
?
EM_GETSEL=0x00B0+ G" @/ S2 G& o8 I6
l' B
EM_SETSEL=0x00B1
EM_GETRECT=0x00B2
EM_SETRECT=0x00B3
EM_SETRECTNP=0x00B4
EM_SCROLL=0x00B5
EM_LINESCROLL=0x00B6
EM_SCROLLCARET=0x00B7
EM_GETMODIFY=0x00B8
EM_SETMODIFY=0x00B9
EM_GETLINECOUNT=0x00BA
EM_LINEINDEX=0x00BB
EM_SETHANDLE=0x00BC
EM_GETHANDLE=0x00BD
EM_GETTHUMB=0x00BE
EM_LINELENGTH=0x00C1
EM_REPLACESEL=0x00C2
EM_GETLINE=0x00C4
EM_FMTLINES=0x00C8
EM_LINEFROMCHAR=0x00C9
EM_SETTABSTOPS=0x00CB5
EM_SETPASSWORDCHAR=0x00CC
EM_EMPTYUNDOBUFFER=0x00CD
EM_GETFIRSTVISIBLELINE=0x00CE
EM_SETREADONLY=0x00CF
EM_SETWORDBREAKPROC=0x00D0
EM_GETWORDBREAKPROC=0x00D1
EM_GETPASSWORDCHAR=0x00D2
EM_SETMARGINS=0x00D3
EM_GETMARGINS=0x00D4
EM_SETLIMITTEXT=EM_LIMITTEXT
EM_GETLIMITTEXT=0x00D5
EM_POSFROMCHAR=0x00D6
EM_CHARFROMPOS=0x00D7
EM_SETIMESTATUS=0x00D8
EM_GETIMESTATUS=0x00D9
BM_GETCHECK=0x00F0
BM_SETCHECK=0x00F1
BM_GETSTATE=0x00F2
BM_SETSTATE=0x00F3
BM_SETSTYLE=0x00F4
BM_CLICK=0x00F5
BM_GETIMAGE=0x00F6
STM_SETICON=0x0170
STM_GETICON=0x0171
DM_GETDEFID=(WM_USER+0)
LB_SETSEL=0x0185
LB_SETCURSEL=0x0186
LB_GETSEL=0x0187
LB_GETCURSEL=0x0188
LB_GETTEXT=0x0189
LB_DIR=0x018D
LB_GETTOPINDEX=0x018E
LB_FINDSTRING=0x018F
LB_GETSELCOUNT=0x0190
LB_SETTABSTOPS=0x0192
LB_GETHORIZONTALEXTENT=0x0193
LB_SETHORIZONTALEXTENT=0x0194
LB_SETITEMDATA=0x019A
LB_SELITEMRANGE=0x019B
LB_SETANCHORINDEX=0x019C
LB_GETANCHORINDEX=0x019D
LB_SETCARETINDEX=0x019E
LB_GETCARETINDEX=0x019F
LB_SETITEMHEIGHT=0x01A0
LB_GETLOCALE=0x01A6
LB_SETCOUNT=0x01A7
LB_INITSTORAGE=0x01A8
LB_ITEMFROMPOINT=0x01A9
LB_MULTIPLEADDSTRING=0x01B1
LB_GETLISTBOXINFO=0x01B2
LB_MSGMAX_501=0x01B3
LB_MSGMAX_WCE4=0x01B1
LB_MSGMAX_4=0x01B0
LB_MSGMAX_PRE4=0x01A8
CB_GETEDITSEL=0x0140
CB_DELETESTRING=0x0144
CB_DIR=0x0145
CB_GETCOUNT=0x0146
CB_GETCURSEL=0x0147
CB_GETLBTEXT=0x0148
CB_GETLBTEXTLEN=0x0149
CB_INSERTSTRING=0x014A
CB_RESETCONTENT=0x014B
CB_SETCURSEL=0x014E
CB_SHOWDROPDOWN=0x014F
CB_SETITEMDATA=0x0151
CB_GETDROPPEDCONTROLRECT=0x0152
CB_SETITEMHEIGHT=0x0153
CB_GETITEMHEIGHT=0x0154
CB_SETEXTENDEDUI=0x0155
CB_GETEXTENDEDUI=0x0156
CB_GETDROPPEDSTATE=0x0157
CB_FINDSTRINGEXACT=0x0158
CB_SETLOCALE=0x0159
CB_GETLOCALE=0x015A
CB_GETTOPINDEX=0x015B
CB_SETTOPINDEX=0x015C
CB_GETHORIZONTALEXTENT=0x015d
CB_SETHORIZONTALEXTENT=0x015e
CB_GETDROPPEDWIDTH=0x015f
CB_SETDROPPEDWIDTH=0x0160
CB_INITSTORAGE=0x0161
CB_MSGMAX_WCE400=0x0163
CB_MSGMAX_400=0x0162
CB_MSGMAX_PRE400=0x015B
SBM_SETPOS=0x00E0
SBM_GETPOS=0x00E1
SBM_SETRANGE=0x00E2
SBM_SETRANGEREDRAW=0x00E6
SBM_GETRANGE=0x00E3
SBM_ENABLE_ARROWS=0x00E4
SBM_GETSCROLLINFO=0x00EA
SBM_GETSCROLLBARINFO=0x00EB
LVM_FIRST=0x1000
TV_FIRST=0x1100
HDM_FIRST=0x1200
TCM_FIRST=0x1300
PGM_FIRST=0x1400
ECM_FIRST=0x1500
BCM_FIRST=0x1600
CBM_FIRST=0x1700
CCM_FIRST=0x2000
CCM_LAST=(CCM_FIRST+0x200)
CCM_GETUNICODEFORMAT=(CCM_FIRST+6)
CCM_GETVERSION=(CCM_FIRST+0x8)
HDM_DELETEITEM=(HDM_FIRST+2)
HDM_SETIMAGELIST=(HDM_FIRST+8)
HDM_SETHOTDIVIDER=(HDM_FIRST+19)
HDM_GETBITMAPMARGIN=(HDM_FIRST+21)
HDM_SETUNICODEFORMAT=CCM_SETUNICODEFORMAT
HDM_GETUNICODEFORMAT=CCM_GETUNICODEFORMAT
HDM_SETFILTERCHANGETIMEOUT=(HDM_FIRST+22)
HDM_EDITFILTER=(HDM_FIRST+23)
TB_INDETERMINATE=(WM_USER+5)
TB_INSERTBUTTON=(WM_USER+21)
TB_CHANGEBITMAP=(WM_USER+43)
TB_GETBUTTONTEXTW=(WM_USER+75)
TB_GETIMAGELIST=(WM_USER+49)
TB_GETHOTIMAGELIST=(WM_USER+53)
TB_GETDISABLEDIMAGELIST=(WM_USER+55)
TB_GETOBJECT=(WM_USER+62)
TB_GETHOTITEM=(WM_USER+71)
TB_GETEXTENDEDSTYLE=(WM_USER+85)
TB_SETUNICODEFORMAT=CCM_SETUNICODEFORMAT
TB_GETUNICODEFORMAT=CCM_GETUNICODEFORMAT
TB_MAPACCELERATORW=(WM_USER+90)
TB_ADDBUTTONSW=(WM_USER+68)
RB_SETBARINFO=(WM_USER+4)
RB_GETBANDINFO=(WM_USER+5)
RB_SETTOOLTIPS=(WM_USER+18)
RB_GETBKCOLOR=(WM_USER+20)
RB_GETTEXTCOLOR=(WM_USER+22)
RB_GETCOLORSCHEME=CCM_GETCOLORSCHEME
RB_BEGINDRAG=(WM_USER+24)
RB_GETBANDINFOA=(WM_USER+29)
RB_MAXIMIZEBAND=(WM_USER+31)
RB_GETUNICODEFORMAT=CCM_GETUNICODEFORMAT
RB_GETBANDMARGINS=(WM_USER+40)
RB_SETWINDOWTHEME=CCM_SETWINDOWTHEME
RB_PUSHCHEVRON=(WM_USER+43)
TTM_ACTIVATE=(WM_USER+1)
TTM_NEWTOOLRECTW=(WM_USER+52)
TTM_GETTEXTW=(WM_USER+56)
TTM_UPDATETIPTEXTW=(WM_USER+57)
TTM_GETTOOLCOUNT=(WM_USER+13)
TTM_ENUMTOOLSW=(WM_USER+58)
TTM_WINDOWFROMPOINT=(WM_USER+16)
TTM_GETTIPTEXTCOLOR=(WM_USER+23)
TTM_SETMAXTIPWIDTH=(WM_USER+24)
TTM_ADJUSTRECT=(WM_USER+31)
TTM_SETTITLEA=(WM_USER+32)
SB_SETTEXTA=(WM_USER+1)
SB_SETMINHEIGHT=(WM_USER+8)
SB_SIMPLE=(WM_USER+9)
SB_SETTIPTEXTW=(WM_USER+17)
SB_GETTIPTEXTW=(WM_USER+19)
SB_GETUNICODEFORMAT=CCM_GETUNICODEFORMAT
SB_SETBKCOLOR=CCM_SETBKCOLOR
SB_SIMPLEID=0x00ff:
TBM_GETPOS=(WM_USER)
TBM_GETRANGEMAX=(WM_USER+2)
TBM_GETNUMTICS=(WM_USER+16)
TBM_GETSELSTART=(WM_USER+17)
TBM_SETTICFREQ=(WM_USER+20)
TBM_GETPAGESIZE=(WM_USER+22)
TBM_GETTHUMBLENGTH=(WM_USER+28)
TBM_GETUNICODEFORMAT=CCM_GETUNICODEFORMAT
DL_BEGINDRAG=(WM_USER+133)
UDM_SETBUDDY=(WM_USER+105)
UDM_GETACCEL=(WM_USER+108)
UDM_SETUNICODEFORMAT=CCM_SETUNICODEFORMAT
UDM_GETUNICODEFORMAT=CCM_GETUNICODEFORMAT
PBM_GETRANGE=(WM_USER+7)
PBM_SETBARCOLOR=(WM_USER+9)
PBM_SETBKCOLOR=CCM_SETBKCOLOR
HKM_SETHOTKEY=(WM_USER+1)
LVM_SETUNICODEFORMAT=CCM_SETUNICODEFORMAT
LVM_GETUNICODEFORMAT=CCM_GETUNICODEFORMAT
LVM_GETBKCOLOR=(LVM_FIRST+0)
LVM_GETITEMA=(LVM_FIRST+5)
LVM_INSERTITEMW=(LVM_FIRST+77)
X4 F: _% l1 o1 S# v8 h: _# A
LVM_DELETEALLITEMS=(LVM_FIRST+9)
LVM_GETITEMRECT=(LVM_FIRST+14)
LVM_GETCOLUMNWIDTH=(LVM_FIRST+29)
LVM_SETTEXTCOLOR=(LVM_FIRST+36)
LVM_GETCOUNTPERPAGE=(LVM_FIRST+40)
LVM_UPDATE=(LVM_FIRST+42)
LVM_SETITEMTEXTW=(LVM_FIRST+116)
LVM_GETITEMSPACING=(LVM_FIRST+51)
LVM_SETCOLUMNORDERARRAY=(LVM_FIRST+58)
LVM_GETHOTITEM=(LVM_FIRST+61)
LVM_GETHOTCURSOR=(LVM_FIRST+63)
LVM_GETTOOLTIPS=(LVM_FIRST+78)
LVM_GETGROUPINFO=(LVM_FIRST+149)
LVM_MOVEGROUP=(LVM_FIRST+151)
LVM_GETGROUPMETRICS=(LVM_FIRST+156)
LVM_SETTILEVIEWINFO=(LVM_FIRST+162)
LVM_GETTILEINFO=(LVM_FIRST+165)
LVM_GETINSERTMARKCOLOR=(LVM_FIRST+171)
LVM_ISGROUPVIEWENABLED=(LVM_FIRST+175)
TVM_GETITEMRECT=(TV_FIRST+4)
TVM_GETITEMW=(TV_FIRST+62)
TVM_SORTCHILDREN=(TV_FIRST+19)
TVM_GETISEARCHSTRINGW=(TV_FIRST+64)
TVM_SETINSERTMARK=(TV_FIRST+26)
TVM_SETUNICODEFORMAT=CCM_SETUNICODEFORMAT
TVM_GETUNICODEFORMAT=CCM_GETUNICODEFORMAT
TVM_SETITEMHEIGHT=(TV_FIRST+27)
TVM_GETBKCOLOR=(TV_FIRST+31)
TVM_GETSCROLLTIME=(TV_FIRST+34)
TVM_GETINSERTMARKCOLOR=(TV_FIRST+38)
TVM_GETLINECOLOR=(TV_FIRST+41)
CBEM_SETITEMA=(WM_USER+5)
CBEM_SETUNICODEFORMAT=CCM_SETUNICODEFORMAT
l
CBEM_GETUNICODEFORMAT=CCM_GETUNICODEFORMAT
CBEM_SETEXSTYLE=(WM_USER+8)
TCM_GETIMAGELIST=(TCM_FIRST+2)
TCM_GETITEMCOUNT=(TCM_FIRST+4)
TCM_GETITEMRECT=(TCM_FIRST+10)
TCM_SETCURSEL=(TCM_FIRST+12)
TCM_GETTOOLTIPS=(TCM_FIRST+45)
TCM_SETTOOLTIPS=(TCM_FIRST+46)
MCM_GETCURSEL=(MCM_FIRST+1)
MCM_SETMAXSELCOUNT=(MCM_FIRST+4)
MCM_SETSELRANGE=(MCM_FIRST+6)
MCM_GETMINREQRECT=(MCM_FIRST+9)
MCM_GETCOLOR=(MCM_FIRST+11)
MCM_GETTODAY=(MCM_FIRST+13)
MCM_SETUNICODEFORMAT=CCM_SETUNICODEFORMAT
MCM_GETUNICODEFORMAT=CCM_GETUNICODEFORMAT
DTM_FIRST=0x1000
DTM_GETSYSTEMTIME=(DTM_FIRST+1)
DTM_GETMCCOLOR=(DTM_FIRST+7)
PGM_GETBKCOLOR=(PGM_FIRST+5)
PGM_SETBUTTONSIZE=(PGM_FIRST+10)
BCM_SETIMAGELIST=(BCM_FIRST+0x0002)
BCM_GETTEXTMARGIN=(BCM_FIRST+0x0005)
EM_SETCUEBANNER=(ECM_FIRST+1)
EM_HIDEBALLOONTIP=(ECM_FIRST+4)
LM_GETITEM=(WM_USER+0x303)
C#中如何截取Windows消息来触发自定义事件的更多相关文章
- mui.fire()触发自定义事件
导读:添加自定义事件监听操作和标准js事件监听类似,可直接通过window对象添加,通过mui.fire()方法可触发目标窗口的自定义事件. 监听自定义事件 添加自定义事件监听操作和标准js事件监听类 ...
- ext中处理Combobox组件点击触发后台事件的问题
ext的Combobox组件在绑定数据的时候需要一个Store来绑定数据,在store里面我们可以设置autoLoad属性,这个属性表示Store可以自动的到后台获取数据,ext实质上就是封装好的ja ...
- 关于Repeater中绑定的控件不触发ItemCommand事件
今天遇到 在repeater 中使用一个button,点击button然后跳转另外一个页面. html. <asp:Repeater ID="repeater" runat= ...
- storage事件中的坑,storage.setItem()无法触发storage事件
一.概述 众所周知,以下代码可以用来监听页面中localstorage和sessionstorage中属性值的变化 window.addEventListener('storage', event=& ...
- Vue自定义事件:触发自定义事件
一 项目结构 二 子组件(Mongo.vue) <template> <button @click="eat">按钮</button> < ...
- Windows API 查找窗体,发送Windows消息
最近项目中需要做Windows消息截获操作,在网上找了一些资料. public class WindowsAPI { /// <summary> /// 回调函数代理 /// </s ...
- wpf自定义控件中使用自定义事件
wpf自定义控件中使用自定义事件 1 创建自定义控件及自定义事件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 ...
- jquery移除、绑定、触发元素事件使用示例详解
这篇文章主要介绍了jquery移除.绑定.触发元素事件使用示例详解,需要的朋友可以参考下. unbind(type [,data]) //data是要移除的函数 $('#btn').unbind(&q ...
- 转: JS自定义事件的定义和触发(createEvent, dispatchEvent)
四.伪DOM自定义事件 这里的“伪DOM自定义事件”是自己定义的一个名词,用来区分DOM自定义事件的.例如jQuery库,其是基于包装器(一个包含DOM元素的中间层)扩展事件的,既与DOM相关,又不直 ...
随机推荐
- js时间格式的转换
function System_dateInit(value) { if (value != null) { var d = new Date(value); ...
- WebApi中帮助页Description的中文显示
转自:http://edi.wang/post/2013/10/28/auto-generate-help-document-aspnet-webapi 我选择Web API的一个重要原因就是因为可以 ...
- UML include、generalization、extend、association
1.别人的说法 转自:http://www.cnblogs.com/shinings/archive/2009/04/21/1440765.html 共性:都是从现有的用例中抽取出公共的那部分信息,作 ...
- String声明为NULL和""的区别
代码虐我千百遍,我待代码如初恋. String 声明为 NULL 则声明了一个变量不指向任何一块地址,则 length()会出现错误. 声明为"",则是一个长度为0的字符串.
- random note
今天才慢慢意识到,什么才是学习,(以思考解决问题为驱动),埋头刷分只是方法,不是目的和原动力. 既然准备读研,就要慢慢去了解研究生的生活学习方式是什么样的,涉及到哪些方面. 读研之前要选好方向,但是现 ...
- 【BZOJ 1066】[SCOI2007]蜥蜴
Description 在一个r行c列的网格地图中有一些高度不同的石柱,一些石柱上站着一些蜥蜴,你的任务是让尽量多的蜥蜴逃到边界外. 每行每列中相邻石柱的距离为1,蜥蜴的跳跃距离是d,即蜥蜴可以跳到平 ...
- [转]控制反转(IOC)和依赖注入(DI)
http://blog.csdn.net/Elite_1989/article/details/16851565 控制反转和依赖注入可以理解成同一个东西,都是为解耦而生的~ 控制反转(IoC=Inve ...
- 【概率】COGS 1487:麻球繁衍
Description 万有引力定律: “使物体相互靠近的力的大小与物体的质量成正比——而物体的质量又由同一种力决定.这是一个有趣并且有益的例子,说明了科学是如何用A证明B,再用B证明A的.”——安布 ...
- where, group by, having
where vs having 当一个sql语句中存在where子句,会先执行where,然后执行group by,然后执行having. 一般来说,only use 'having' when yo ...
- eclipse 安装配置maven
1.安装maven 插件 从eclipse 3.7(indigo)之后,m2e 插件已host到eclipse.org 站点下: Since Eclipse 3.7 (Indigo), m2e is ...