All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
(asp.net+Access)图片上传到数据库同时显示_[Asp.Net教程]
水晶报表基础操作技巧_[Asp.Net教程]
Visual,Studio2005发布问题解决办法_[Asp.Net教程]
Delphi带进度条的状态栏实例
asp.net代码实现上传图片并生成缩略图_[Asp.Net教程]
SQLServer,2000企业版安装教程(1)_[SQL,Server教程]
asp.net验证控件失效原因及解决方法_[Asp.Net教程]
小结:PHP动态网页程序两个有用的小技巧_php资料_编程技术
c#中类的概念
C#中ComboBox控件应用实例
Reading number is top 10 pictures
Abdominal hit by iron--HangZhou best driver parking save passengers
无题
So beauty, will let you spray blood7
YangYuYing and ZhengShaoQiu dance on the generous come interest dye-in-the-wood
Look for from human art net, is good--2
餐桌上的鱼
China's first snake village2
NeedWallpaper6
The sixties of the last century, China is such a kill pig
毛俊杰-能量永动机
Download software ranking
网络管理员第三版
都市狐狸姑娘传
The king of fighters 97(Mobile phone games-apk)
Unix video tutorial2
天龙八部最新服务端
仙剑奇侠传98版歌曲
WebService在.NET中的实战应用教学视频 → 第1集
Unix video tutorial4
Photoshop 8.0图象编辑软件
传奇私服架设教程
delv published in(发表于) 2014/1/6 9:14:22 Edit(编辑)
用ImessageFilter实现截获键盘动作_[Asp.Net教程]

用ImessageFilter实现截获键盘动作_[Asp.Net教程]

用ImessageFilter实现截获键盘动作_[Asp.Net教程]

IMessageFilter 接口
IMessageFilter 接口允许应用程序在消息被调度到控件或窗体之前捕获它。


可以将实现 IMessageFilter 接口的类添加到应用程序的消息泵中,以在消息被调度到控件或窗体之前将


它筛选出来或执行其他操作。若要将消息筛选器添加到应用程序的消息泵中,请使用 Application 类中的


AddMessageFilter 方法。



Application.AddMessageFilter 方法


添加消息筛选器以便在向目标传送 Windows 消息时监视这些消息。
[Visual Basic]
Public Shared Sub AddMessageFilter( ByVal value As IMessageFilter )


参数
value
您要安装的 IMessageFilter 接口的实现。
备注
使用消息筛选器来防止引发特定事件,或在将某事件传递给事件处理程序之前使用消息筛选器对其执行特


殊操作。消息筛选器对特定线程是唯一的。
若要防止调度某消息,传递给该方法的 value 参数实例必须用处理该消息的代码重写 PreFilterMessage 方法


。该方法必须返回 false。
警告 向应用程序的消息泵添加消息筛选器会降低性能。
示例
[Visual Basic, C#, C++] 必须先提供 IMessageFilter 接口的一个实现,然后才可以使用消息筛选器。


下面的类创建一个名为 TestMessageFilter 的消息筛选器。此筛选器阻止与鼠标左键有关的所有消息。
[Visual Basic]
' Creates a message filter.
Public Class TestMessageFilter
Implements IMessageFilter


Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) _
As Boolean Implements IMessageFilter.PreFilterMessage
' Blocks all the messages relating to the left mouse button.
If ((m.Msg >= 513) And (m.Msg <= 515)) Then
Console.WriteLine("Processing the messages : " & m.Msg)
Return True
End If
Return False
End Function
End Class


用Esc键退出程序


  
   Implements IMessageFilter


  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


MyBase.Load
'assign message to app and form
Application.AddMessageFilter(Me)
End Sub



  Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) As Boolean


Implements IMessageFilter.PreFilterMessage


Dim keyCode As Keys = CType(m.WParam.ToInt32(), Keys) And Keys.KeyCode
If keyCode = Keys.Escape Then
End  '结束程序。我们在此可以调用各种方法、过程。
End If
   End Function







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.