Function GetColorInCursor
Function GetCursorBitmap
;/
function# x y [flags] ;;flags: 1 x y are relative to the hot spot
;Returns a color in the current cursor (mouse pointer).
;Returns -1 on failure.
;x, y - pixel coordinates relative to the top-left corner of the cursor. If flag 1 used - relative to the hot spot (which is at the mouse position) of the cursor.
;EXAMPLE
;rep
,;1
,;out "0x%X" GetColorInCursor(0 0 1) ;;color at the hot spot (mouse position)
__MemBmp mb; POINT p
if(!GetCursorBitmap(mb &p)) ret CLR_INVALID
if(flags&1) x+p.x; y+p.y
ret GetPixel(mb.dc x y)
Function GetCursorBitmap
;/
function# __MemBmp&mb [POINT*hotspot]
;Gets memory bitmap of the current cursor (mouse pointer).
;Transparent parts will be white.
;Also can optionally get hotspot position within the cursor.
;Returns cursor handle on success, 0 on failure.
CURSORINFO ci.cbSize=sizeof(CURSORINFO)
if(!GetCursorInfo(&ci)) ret
if(hotspot)
,ICONINFO ii
,if(!GetIconInfo(ci.hCursor &ii)) ret
,DeleteObject ii.hbmMask
,DeleteObject ii.hbmColor
,hotspot.x=ii.xHotspot; hotspot.y=ii.yHotspot
,
mb.Create(32 32)
RECT r.right=32; r.bottom=32; FillRect mb.dc &r GetStockObject(WHITE_BRUSH)
if(!DrawIconEx(mb.dc 0 0 ci.hCursor 32 32 0 0 DI_NORMAL)) ret
ret ci.hCursor