hello there,
I'm currently working on my project using Low-Level Mouse Hook.
I have question about that hooking thing..
1. Is there any way that I could determine middle-button click when I used low-level mouse hook?
2. any trick to determine when I double-clicked the mouse? because the e.Clicks always return zero value..
I'm using C# 2005 express edition with .NET 2.0 Framework..
thankz for the information, I hardly found any information related in this forum...
Loading
wienzzz jokerPosted Sep 5, 2007, 11:16 PM
I'm using mouse hooking because I want to track my mouse activity outside of my apps..
I've finally managed the middle button, but still, I couldn't find the suitable code for double-click.
I've read in microsoft msdn that double-clicking the mouse is actually calling mouseDown, mouseUp, mouseDown, and mouseUp again sequentially. But I still don't know how to use it.
thx for the info anyway.
regards
~erwin~
Mike GoldPosted Aug 30, 2007, 7:09 PM
What do you mean low level mouse hook and why would you want to use it?
You can just as easily use MouseDown, MouseUp, MouseDoubleClick, MouseCaptureChanged, MouseHover, MouseLeave, MouseEnter, and MouseMove events in a form to do anything you want.
If you need to determine if the middle button has been clicked:
private void Form1_MouseDown(object sender, MouseEventArgs e){
if (e.Button == MouseButtons.Middle){
// do what you gotta do}
}
To handle double clicking use a MouseDoubleClick event handler:
private void Form1_MouseDoubleClick(object sender, MouseEventArgs e){
int x = e.X; int y = e.Y;}
Here are the event handler subscriptions from the designer:
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown); this.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDoubleClick);