Link to home
Start Free TrialLog in
Avatar of Brothernod
Brothernod

asked on

How can I track the mouse position in windows?

I want to write a service that keeps track of when the mouse enters certain pixels on the screen.  I want it to be transparent to the other operations of my computer.  Basically I want to make a screen saver that is monitor independant since I have 2 lcds and don't want to burn out my 2nd one when i'm not using it.

Any ideas?

Avatar of levyuk
levyuk

Well oyu can get the mouse position using this code

Control.MousePosition
you may have to access the win32 gdi library to catch those events
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brothernod

ASKER

Sorry RL got busy, i'll look at this Wednesday.  Don't mean to keep you hanging.
Ok.... so this is totally beyond anything I've ever looked at before.  How do I use it?
My goal is to be able to keep track of the last time my mouse has entered my 2nd monitor so that I can turn off the monitor when the mouse hasn't entered it for say 5 minutes.
I can certainly modify the code to detect when the mouse has not entered the second monitor in the last five minutes...but I can't find any code that puts a second monitor into standby mode.  All the posts I find say that using the SC_MONITORPOWER command puts both monitors in standby mode and there is no way to target just the second monitor...
Well I figured it would be hard to put the monitors into standby mode, so what I figured I would do is create a new form and just place it over the entire pixel space of the 2nd monitor (or the first monitor).  I'd color it black initially, and eventually probably add some sort of effect for pizzaz.