types - C# - How to get current cursor state (if its currently arrow,hand,waiting etc) -


i tried make bot 1 game, have cool anti pixel bot techniques.. :d thought like.. "if can make bot checks if cursor changes hand , click, gonna work".. koz gonna need collect bonus boxes, , when point cursor @ it, changes "hand" cursor..

so happy idea.. but... dafuq c#, not working!

in c# - cursor.current checks cursor state on form , not in whole computer ! annoying huh?

so.. how real cursor-type state ? (if hand, normal cursor..sizing or waiting etc) kinda desperate this.. bright ideas!

ok, found , made working, heres code if needed :

    private static string getcursorstate()     {         var h = cursors.waitcursor.handle;          cursorinfo pci;         pci.cbsize = marshal.sizeof(typeof(cursorinfo));         getcursorinfo(out pci);           return pci.hcursor.tostring();     }      [structlayout(layoutkind.sequential)]     struct point     {         public int32 x;         public int32 y;     }      [structlayout(layoutkind.sequential)]     struct cursorinfo     {         public int32 cbsize;        // specifies size, in bytes, of structure.          // caller must set marshal.sizeof(typeof(cursorinfo)).         public int32 flags;         // specifies cursor state. parameter can 1 of following values:         //    0             cursor hidden.         //    cursor_showing    cursor showing.         public intptr hcursor;          // handle cursor.          public point ptscreenpos;       // point structure receives screen coordinates of cursor.      }      [dllimport("user32.dll")]     static extern bool getcursorinfo(out cursorinfo pci); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -