Detecting a Mouse click from a windows service

B

Benoit Martin

Is it possible to detect a mouse click from a .net service. I want a process
running in the background that will detect when the user clicks the mouse
button (anywhere on the screen) and executes an action accordingly.
All the event handlers for the mouse that I see are for Windows Forms. Is
there a way to do it without any controls on the screen?

Thanks
 
G

Guest

If you where using mfc c++ you would do it trough windows hooks.

Start with reading this article about system wide hooks in MFC.
http://www.codeguru.com/Cpp/COM-Tech/shell/article.php/c4509/

Best regards Björn Olsson
Head of Technology
Centre for Business Solutions
Gothenburg School of Economics and Commercial Law
University of Göteborg
Department of Business and Administration
PO BOX 610
SE-405 30 Gothenburg Sweden
P: +46317732767
C: +46708630872
F: +46317734754
 
J

John Timney \( MVP \)

A service has no concept of user interface, thus click events are pointless
to it. You can however allow it to interact with the desktop, but its
cumbersome.

See this thread.
http://groups.google.co.uk/group/mi...windows+service&rnum=9&hl=en#a96e24000f87a629

Its definatelyt nor recommened in a .net service. If I was developing this
I would create a small desktop application to listen for clicks, and
communciate them to the listening service via a socket call. One other
thing - youre talking about a global event hook and thats highly processor
and resource hungry.

http://www.codeproject.com/csharp/globalhook.asp

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top