Cursor detection problem
-
I'm trying to detect which cursor is currently shown on the screen, whether it is a wait cursor, arrow cursor, etc. Right now, the detection works perfectly EXCEPT that there are 3 cursors that i can't seem to detect sometimes - the hand cursor, horizontal and vertical splitter cursors. The code i'm using is (with the GetCursorInfo API): Info.Size = Marshal.SizeOf(Info.GetType()); GetCursorInfo(out Info); if (Info.Cursor == Cursors.WaitCursor.Handle) CurrentCursor = "Wait"; else if (Info.Cursor == Cursors.Default.Handle) CurrentCursor = "Default"; else if (Info.Cursor == Cursors.AppStarting.Handle) CurrentCursor = "Loading"; else if (Info.Cursor == Cursors.Hand.Handle) CurrentCursor = "Hand"; .... After i did some tests, i noticed that when i convert the values to string, the two values of Info.Cursor and Cursors.Hand.Handle (along with the HSplit and VSplit values as well) do not tally and they tend to change over and over again almost every time i run my application again. The tests were done by displaying the values of Info.Cursor and Cursors.Hand.Handle using codes like these: MessageBox.Show(Info.Cursor.ToString()); MessageBox.Show(Cursors.Hand.Handle.ToString()); I did the tests mostly on Applications that have a weblink and also on web browsers. When using a web browser, the detection seems fine (for the hand cursor at least) but when i run an app that has a weblink somewhere and the hand cursor shows up, the values of Info.Cursor and Cursors.Hand.Handle are totally different. Is there a way around this?
-
I'm trying to detect which cursor is currently shown on the screen, whether it is a wait cursor, arrow cursor, etc. Right now, the detection works perfectly EXCEPT that there are 3 cursors that i can't seem to detect sometimes - the hand cursor, horizontal and vertical splitter cursors. The code i'm using is (with the GetCursorInfo API): Info.Size = Marshal.SizeOf(Info.GetType()); GetCursorInfo(out Info); if (Info.Cursor == Cursors.WaitCursor.Handle) CurrentCursor = "Wait"; else if (Info.Cursor == Cursors.Default.Handle) CurrentCursor = "Default"; else if (Info.Cursor == Cursors.AppStarting.Handle) CurrentCursor = "Loading"; else if (Info.Cursor == Cursors.Hand.Handle) CurrentCursor = "Hand"; .... After i did some tests, i noticed that when i convert the values to string, the two values of Info.Cursor and Cursors.Hand.Handle (along with the HSplit and VSplit values as well) do not tally and they tend to change over and over again almost every time i run my application again. The tests were done by displaying the values of Info.Cursor and Cursors.Hand.Handle using codes like these: MessageBox.Show(Info.Cursor.ToString()); MessageBox.Show(Cursors.Hand.Handle.ToString()); I did the tests mostly on Applications that have a weblink and also on web browsers. When using a web browser, the detection seems fine (for the hand cursor at least) but when i run an app that has a weblink somewhere and the hand cursor shows up, the values of Info.Cursor and Cursors.Hand.Handle are totally different. Is there a way around this?
try using the .NET way,
Cursor.Current
:) Another Post by NnamdiOnyeyiri l Website -
try using the .NET way,
Cursor.Current
:) Another Post by NnamdiOnyeyiri l Website