471,326 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,326 software developers and data experts.

Checking cursor type

ACS
I have a C# application where I've grabbed a control's cursor handle
using the WINAPI function GetCursor(). This returned an IntPtr and I
want to check what type of cursor this is (arrow, sizing, hourglass,
etc.)

I've tried the following:
- Comparing the IntPtr to C#'s predefined cursor types (i.e.
Cursors.Arrow.CopyHandle())
- Comparing the IntPtr to another IntPtr obtained using the WINAPI
function LoadCursor

With different variations but none seem to work. Does anyone have any
ideas?
Jun 27 '08 #1
2 5349
ACS
After doing a bit of research, it seems one option might be to capture
the bitmap image of the cursor and compare it against the bitmap image
of a standard cursor. Unfortunately I don't see a way of doing this
having just the cursor's handle...

On Apr 15, 12:05 am, ACS <volt9...@gmail.comwrote:
I have a C# application where I've grabbed a control's cursor handle
using the WINAPI function GetCursor(). This returned an IntPtr and I
want to check what type of cursor this is (arrow, sizing, hourglass,
etc.)

I've tried the following:
- Comparing the IntPtr to C#'s predefined cursor types (i.e.
Cursors.Arrow.CopyHandle())
- Comparing the IntPtr to another IntPtr obtained using the WINAPI
function LoadCursor

With different variations but none seem to work. Does anyone have any
ideas?
Jun 27 '08 #2
ACS
Ok well it seems what I was attempting to do was futile since I found
a much easier way of doing it.

Basically what I'm doing is this: I'm detecting if a cursor changes to
a particular type in a particular control; in this case the split/
resize cursor in the ListView. This cursor appears when there is a 0-
width column in a ListView and you hover the mouse directly to the
right of it. This cursor has a double vertical bar and appears in
place of the default resize cursor, which has only a single vertical
bar (when merely resizing a column without another hidden column.)

The problem is, the "default" resizer (single vertical bar) is NOT the
same as Cursors.VSplit since the ListView control apparently has some
custom cursors embedded in it.
So my new question is this: Is there any way to extract or access
these custom cursors so I can tell what Cursor.Current is set to?

On Apr 15, 12:24 am, ACS <volt9...@gmail.comwrote:
After doing a bit of research, it seems one option might be to capture
the bitmap image of the cursor and compare it against the bitmap image
of a standard cursor. Unfortunately I don't see a way of doing this
having just the cursor's handle...

On Apr 15, 12:05 am, ACS <volt9...@gmail.comwrote:
I have a C# application where I've grabbed a control's cursor handle
using the WINAPI function GetCursor(). This returned an IntPtr and I
want to check what type of cursor this is (arrow, sizing, hourglass,
etc.)
I've tried the following:
- Comparing the IntPtr to C#'s predefined cursor types (i.e.
Cursors.Arrow.CopyHandle())
- Comparing the IntPtr to another IntPtr obtained using the WINAPI
function LoadCursor
With different variations but none seem to work. Does anyone have any
ideas?
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

debasisdas
reply views Thread by debasisdas | last post: by
debasisdas
reply views Thread by debasisdas | last post: by
7 posts views Thread by nospam | last post: by

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.