Mouse Cursor Monitoring

NeuralJack

Well-known member
Joined
Jul 28, 2005
Messages
138
Hello All, I was wondering what the best way to monitor the mouse cursor graphics image would be. Is there a variable I can monitor on a while loop that shows where the cursor gets its image (i.e. filename)?

Id need this to monitoring even as the mouse moves across different windows. I want it to monitor what the cursor graphic is as it runs across windows using directx graphics well. Im not sure if thats possible.

If the filename cant be retieved then some other identifier would be nice, even the mouse cursor image itself! If i could grab the mouse cursor image at certain time intervals thatd be great. I dont think that the cursor handle would work because each time it changes it also changes the handle(i think). I need to be able to identify and distinguish between different mouse cursors.

I dont do much vb.net programming with graphics but im guessing theres a way to grab the current cursor and put it into a picture box. If there is please give me an example of that, because I can use that to compare cursors.

I am also familiar with APIs, although setting them up in .NET has proven to be so irritating half the time, since Microsoft really went the extra mile to make APIs and .NET platform hard to use together. So, if you use APIs please show me how you declare and use them. Note: If you can get the current cursor image to display on a picturebox then I can do the rest :)

Any help would be really appreciated.
 
I dont quite understand what you are trying to do. If you could explain your objective differently maybe I could help. Are you trying to use a custom bitmap for the cursor? i.e. change the icon of the cursor when it is in a certian area of the screen?
 
Hi there, sorry i didnt reply quicker, i gave it about 3 wks than gave up checking on this thread.
No, i dont want to change the cursor or anything like that. I just want to monitor where the current cursor image is coming from.

As you move the cursor across a screen it will change based on where it is and what it is hovering over. This is dependent on the program it is currently over and what that program designates as its cursor on that control. I want to detect when there is a cursor change.

So lets say im hovering over a program and then i hover over a textbox - well, the cursor just changed, and i want to detect that. Things that will tell me if it changed or not are things like if i could keep retrieving the current cursor img filename (then note if it changed), or a cursor handle may work as well.

so, if there is a way to retrieve the current cursor img filename, no matter what program the mouse cursor is over, then Id be thrilled to use it.

Thanks for the reply.
 
Cursor.Handle (which is the same as typing Me.Cursor.Handle) returns the handle to the cursor set for the object for which you are writing code, generally a form. This means that if the cursor is over something other than the object you are coding, there is a good chance that the handle returned will not be what you are looking for.

I did a quick google search and found some information here: [http://delphi.about.com/od/graphics/l/aa021004a.htm]. I only glanced over it, so I dont know how good the info is. The code is in Delphi, but the Windows API aspect should still be relevant. At least it is a start.
 
Thanks a lot guys. These forums are great. Ill have to take a harder look at that Delphi article at some point and im hoping the APIs they use will help me out.

Yes, if i could grab the cursor bmp that would also help me detect a cursor change because i could monitor it with the handy dandy GetPixel API.

Since writing this i have come up with a nasty work around for what im trying to do but doing it by monitoring the cursor would be about 1000x more efficient.

Being a casual programmer Im out of my league talking about the politics of .NET but Ive got to say that they could have implemented APIs into the language easier IMO. It seems almost every .NET programmer uses APIs when they want to actually get something done... so why not make them a more integral part to the .NET language. Not only this, but APIs are actually much harder to use in .NET because many of them need to be implemented differently than older versions of VB.. and that new implementation is not widely available information. I cant tell you how many times ive tried to use examples of APIs, whose example is in VB6, that wont work with that same way in .NET. All of the websites dedicated to APIs have examples used in VB6 or lower.

Ah well thats my rant. thanks for the help.
 
Back
Top