468,484 Members | 1,578 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,484 developers. It's quick & easy.

Hooking mouse event - question of performances

Hello,
I try to develop application that runs in the background and suppose to
display a small form with menu whenever the user clicks the middle mouse
button (also when my application is not the active one).
I have found a nice way to do it with hooking mouse events and reactring
accordingly. but I'm affriad that this method is a performances killer for
the OS.
Is there a better way to do it? How "killer" is my way anyway?

Thanks!
Tom.
Nov 4 '07 #1
1 1211
If you need a global event then a windows Hook is the way to do it. The
performance impact will be based solely on what you are doing. It's
possible to write the handler so that it doesn't impact performance.

A few things to note. You should provide your users the ability to disable
this hook easily. Some of us are already running custom mouse drivers that
let us override mouse clicks. Don't assume that we always want to use your
functionality instead of what we have set up. There may be other cases
where your functionality could screw us up. For example if the user is in a
game, having your form pop up because they accidentally clicked a button
could crash the game. Finally, I've never built a hook in .Net, so can't
comment on the performance in a managed language. However, I do know that
in C++ at least I've built hooks that had no noticable impact on
performance.

--
Andrew Faust
andrew[at]andrewfaust.com
http://www.andrewfaust.com
"Tom Rahav" <to*@clinic-tech.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hello,
I try to develop application that runs in the background and suppose to
display a small form with menu whenever the user clicks the middle mouse
button (also when my application is not the active one).
I have found a nice way to do it with hooking mouse events and reactring
accordingly. but I'm affriad that this method is a performances killer
for the OS.
Is there a better way to do it? How "killer" is my way anyway?

Thanks!
Tom.
Nov 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by John Champaign | last post: by
9 posts views Thread by punkin | last post: by
1 post views Thread by Matthew Kelly | last post: by
3 posts views Thread by mitsura | last post: by
3 posts views Thread by Rick Strahl [MVP] | last post: by
8 posts views Thread by pigeonrandle | last post: by
reply views Thread by theflame83 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.