473,394 Members | 1,642 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,394 software developers and data experts.

Cursor Move

Is there an event for when the cursor moves? Not for a form, but for the whole screen?

--
I am a 14 year old C# developer, I am completely self taught, so please don't get mad if I ask a stupid question. Thanks.
Nov 16 '05 #1
6 4970
Hi,

I dont think, there is any event to trap the "mousemove" within the
application, when you move mouse over the desktop (other than the app).
However, events like "SystemColors changed" can be trapped inside our
application when its changed OS level.

We can do other stuffs like monitering directories using "File Watchers"
which will raise event when something is changed in the directory of which
we are watching.

Sometimes, when there is a change in Env or registry values, HWND_BROADCAST
will raise an event inside our application. We can catch it and process.

The feature you are looking is really worth to have it, if microsoft exposes
it to developers. I believe they have this method for their applications,
like word or excel.

Shak.
"Bill English" <nu****@comcast.net> wrote in message
news:4D**********************************@microsof t.com...
Is there an event for when the cursor moves? Not for a form, but for the whole screen?
--
I am a 14 year old C# developer, I am completely self taught, so please

don't get mad if I ask a stupid question. Thanks.
Nov 16 '05 #2
Another thought.

The closest thing which you can do imitating Microsoft spy++. Using
mousemove you can find the window, and get the class and handle for each
control of external application including desktop by this approach. If this
is ur goal, then simulate spy++.

Shak.

"Bill English" <nu****@comcast.net> wrote in message
news:4D**********************************@microsof t.com...
Is there an event for when the cursor moves? Not for a form, but for the whole screen?
--
I am a 14 year old C# developer, I am completely self taught, so please

don't get mad if I ask a stupid question. Thanks.
Nov 16 '05 #3
AFAIK it can't be done without resorting to the Win32 API. The function you
would use is SetWindowsHookEx. Since you want the events for the whole
screen you're looking at a global hook. I believe for global hooks you'll
have to build it into a DLL, and I also believe you may have to do some
unmanaged coding. Note also that global hooks have a performance hit
associated with them.

What exactly are you trying to achieve? It could be that there's some
alternative based on your proposed usage.

Stu

"Bill English" <nu****@comcast.net> wrote in message
news:4D**********************************@microsof t.com...
Is there an event for when the cursor moves? Not for a form, but for the whole screen?
--
I am a 14 year old C# developer, I am completely self taught, so please

don't get mad if I ask a stupid question. Thanks.
Nov 16 '05 #4


What is the difference between managed and unmanaged code?

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #5

"Bill English" <nu****@comcast.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...


What is the difference between managed and unmanaged code?
Managed code is what is produced when you code in C#, VB.NET, or Managed
C++. According to MS, the definition is:

"Code executed and managed by the Microsoft® .NET Framework, specifically by
the .NET Framework's common language runtime. Managed code must supply the
information necessary for the common language runtime to provide services
such as memory management, cross-language integration, code access security,
and automatic lifetime control of objects. All code based on Microsoft
Intermediate Language executes as managed code."

Unmanaged code is what is produced by 'standard' C++ or C etc:

"Code that is executed directly by the operating system, outside the
Microsoft .NET Framework's common language runtime. Unmanaged code must
provide its own memory management, type checking, and security support,
unlike managed code, which receives these services from the common language
runtime. Unmanaged code must be executed outside the .NET Framework."

So basically, if you want to install a global hook, you're almost certainly
going to have to write unmanaged code, probably in the form of a C or C++
DLL. You'll then have to write some code that can interface between that and
the rest of your application, which I'm assuming is in C#. That interface
layer will either be in Managed C++, or will be P/Invoke calls from C#.

Stu


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #6
Try this class

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

It allows you to globally hook the mouse and keyboard events using c# and
dotnet.

HTH

John
"Bill English" <nu****@comcast.net> wrote in message
news:4D**********************************@microsof t.com...
Is there an event for when the cursor moves? Not for a form, but for the
whole screen?

--
I am a 14 year old C# developer, I am completely self taught, so please
don't get mad if I ask a stupid question. Thanks.

Nov 16 '05 #7

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

Similar topics

3
by: Csaba2000 | last post by:
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the mouse button is released. On Opera 7.01, the setting...
10
by: Bill H | last post by:
I used a bit of JS on a page that is fairly long and didn't like the way that <A HREF='#' ONCLICK=\"... refreshed the page to the top. Removing the HREF (<A ONCLICK=\"...) solved my...
0
by: washingtonirving | last post by:
Hi. I sent this bug to the bugs mailing list. But the email never turned up on the list. Could somebody here tell me what I'm doing wrong, and why the email won't show up? Am I breaking some...
4
by: **Developer** | last post by:
I have a Listbox application. I allow users to drag items from one spot in the listbox to another spot. I also allow them to drag to, say, WordPad In the DoDragDrop I use DragDropEffects.Copy so...
3
by: Christoffer Gurell | last post by:
After declaring a cursor. Is there any way you can check the number of rows that cursor contains ?? / Christoffer Gurell ---------------------------(end of...
1
by: Jason J. Hedges | last post by:
I posted this in dotnet.framework.windowsforms and haven't received a reply. Hopefully someone here can help. I have a windows form (.Net 1.1) with a text box and some combo boxes on it. The...
4
by: yan.python | last post by:
i have a question. when i run Interactive Interpreter in linux command promt,how can i move the cursor. for example,when i enter a string,i often enter the quotation mark "" first,and the move...
1
by: yeohyc | last post by:
Hi All, I have a problem here. I have done a request for move order it was stored into a custom table with the format: (O)336126(G)83(I)21823(M)630065120(L)LOT-DISB2P-01(Q)2500...
4
by: mike | last post by:
I have the opportunity to rescue a project that uses a mouse to sense the relative position of a machine. The hardware is built...just needs to be programmed. Stop snickering!!! I didn't do it...I...
5
by: michels287 | last post by:
Right now I have a touchscreen with a virual keyboard. I would like to create arrow keys. If the user messed up the inputted text, he can move the blinking cursor left one space at a time between...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.