473,413 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Detecting a Mouse click from a windows service

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
Nov 1 '05 #1
2 4847
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...cle.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
"Benoit Martin" wrote:
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

Nov 2 '05 #2
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/mic...6e24000f87a629

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

"Benoit Martin" <be****@digitalmediums.com> wrote in message
news:eW*************@TK2MSFTNGP10.phx.gbl...
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

Nov 2 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: BadOmen | last post by:
I want my program to send a mouse click to the window at the current mouse position, how do I do that? Example: I have my mouse over a button in Word and then my program is sending the left...
0
by: Chris Mullins | last post by:
I have a Windows Service that I created using Visual Studio.NET 2003. No custom code, just an empty Windows Service. In VS.NET, I right click on the service, and say "Add Installer", to create a...
6
by: jcrouse | last post by:
I have the following mouse events assigned to a label control. Is the a way I can tell which mouse button the users has clicked with? Private Sub lblP1JoyUp_Click(ByVal sender As System.Object,...
3
by: jcrouse | last post by:
I have created a form designer type application (with a lot of you peoples helpJ). It has label controls that are draggable at runtime. The user is also allowed to change some properties such as...
2
by: Benoit Martin | last post by:
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...
5
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event...
3
by: Morten Snedker | last post by:
If I have a number of random applications open, move the mouse cursor to a given position and do a click, the application gets the focus. That is what this simple code should illustrate: Dim...
1
by: Przemek M. Zawada | last post by:
Dear Group, I have got two mice connected to one PC (notebook). In example I click parallel left button on mouse A and left button on mouse B. Is it possible, programmatically detect which on...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.