NeuralJack Posted August 26, 2005 Posted August 26, 2005 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 it's image (i.e. filename)? I'd 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. I'm not sure if that's 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 that'd 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 i'm guessing there's 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 API's, although setting them up in .NET has proven to be so irritating half the time, since Microsoft really went the extra mile to make API's and .NET platform hard to use together. So, if you use API's 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. Quote Currently Using: Visual Basic.Net 2005, .Net Framework 2.0
Nate Bross Posted September 16, 2005 Posted September 16, 2005 I don't 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? Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
NeuralJack Posted September 26, 2005 Author Posted September 26, 2005 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 it's cursor on that control. I want to detect when there is a cursor change. So lets say i'm 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 I'd be thrilled to use it. Thanks for the reply. Quote Currently Using: Visual Basic.Net 2005, .Net Framework 2.0
Nate Bross Posted September 26, 2005 Posted September 26, 2005 You could use Cursor.Handle() But I do not know how you would detect the chanes the image/filename. Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Leaders snarfblam Posted September 26, 2005 Leaders Posted September 26, 2005 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 don't 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. Quote [sIGPIC]e[/sIGPIC]
NeuralJack Posted September 27, 2005 Author Posted September 27, 2005 Thanks a lot guys. These forums are great. I'll have to take a harder look at that Delphi article at some point and i'm hoping the API's 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 i'm trying to do but doing it by monitoring the cursor would be about 1000x more efficient. Being a casual programmer I'm out of my league talking about the politics of .NET but I've got to say that they could have implemented APIs into the language easier IMO. It seems almost every .NET programmer uses API's 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 API's 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 i've tried to use examples of API's, whose example is in VB6, that wont work with that same way in .NET. All of the websites dedicated to API's have examples used in VB6 or lower. Ah well thats my rant. thanks for the help. Quote Currently Using: Visual Basic.Net 2005, .Net Framework 2.0
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.