473,803 Members | 4,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4930
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****@digital mediums.com> wrote in message
news:eW******** *****@TK2MSFTNG P10.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
32661
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 mouse click and the button under the mouse is clicked. Yours, Jonas
0
2023
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 custom installer for it inside my project. No custom code, just an empty installer as generated by VS.NET. I then create a Deployment project, and set the "custom action" for each of the steps to run the installer found in the Windows Service...
6
6998
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, ByVal e As System.EventArgs) Handles lblP1JoyUp.Click If bMouseMove = False Then If bCtrlKey = True Then
3
2079
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 forecolor, backcolor and font. The labels also are rotatable and the text can also be flipped 180 degrees (the flipped text part is still being worked on). I have one context menu for all 30 labels that allows for the property changes to the labels....
2
402
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 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
5
4748
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 gets triggered and the double click is not identified at all. Is there any way I can invoke the double click when the mouse move also exists?
3
3770
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 pt As Point Dim wnd As IntPtr Const WM_LBUTTONUP = &H202 '//LButton up Const WM_LBUTTONDOWN = &H201 '//LButton down
1
2290
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 which mouse which button has been clicked? Mainly, the thing what I'm doing is to connect to 'scroll button click' a Halls sensor (contactron), one for each mouse, and I need to count down the sensor signals. The simplest way is to fetch the mouse
0
9700
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10310
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9121
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7603
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6841
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.