By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,200 Members | 1,559 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,200 IT Pros & Developers. It's quick & easy.

Hooking mouse event - question of performances

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.