Checking cursor type

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ACS

    #1

    Checking cursor type

    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.C opyHandle())
    - 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?
  • ACS

    #2
    Re: Checking cursor type

    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.C opyHandle())
    - 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?

    Comment

    • ACS

      #3
      Re: Checking cursor type

      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.C opyHandle())
      - 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?

      Comment

      Working...