除了使用hook外,下面的代码也能够在全局捕捉鼠标:(csdn)
2008-05-01 03:19
253 查看
dy_2000_abc(芝麻开门)
public class Form1 : System.Windows.Forms.Form,IMessageFilter
{
private System.Windows.Forms.Button button1;
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
Application.AddMessageFilter(this);
}
public bool PreFilterMessage(ref Message msg)
{
if (msg.Msg==0x205)
{
this.button1.Visible=true;
return true;
}
else
if (msg.Msg==0x201)
{
this.button1.Visible=false;
return true;
}
else
return false;
}
}
}
public class Form1 : System.Windows.Forms.Form,IMessageFilter
{
private System.Windows.Forms.Button button1;
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
Application.AddMessageFilter(this);
}
public bool PreFilterMessage(ref Message msg)
{
if (msg.Msg==0x205)
{
this.button1.Visible=true;
return true;
}
else
if (msg.Msg==0x201)
{
this.button1.Visible=false;
return true;
}
else
return false;
}
}
}
相关文章推荐
- 在C#中使用全局鼠标、键盘Hook
- 鼠标锁代码(未使用HOOK)
- 如何在C#中使用全局鼠标、键盘Hook
- 如何在C#中使用全局鼠标、键盘Hook
- 在C#中使用全局鼠标、键盘Hook
- 如何在C#中使用全局鼠标、键盘Hook
- C#中使用全局鼠标Hook实现全局双击动作捕获
- c# 使用hook来监控鼠标键盘事件的示例代码
- 如何在C#中使用全局鼠标、键盘Hook
- 如何在C#中使用全局鼠标、键盘Hook
- 真正的.NET环境下的全局键盘鼠标Hook代码
- 如何在C#中使用全局鼠标、键盘Hook
- 如何在C#中使用全局鼠标、键盘Hook
- 如何在C#中使用全局鼠标、键盘Hook
- 如何在C#中使用全局鼠标、键盘Hook
- 如何在C#中使用全局鼠标、键盘Hook
- 使用C#钩子监视全局鼠标位置
- 使用JS或jQuery模拟鼠标点击a标签事件代码
- 网页上记录鼠标的点击次数和一段有用的php代码,自己学习使用
- 在QTP中,经常会遇到需要写入外部文件的地方,比如写Log什么的,这时,可以使用下面代码进行写Txt操作。