I search the internet but i can't find answer. please help me
"msdn cursor" in a motor search.
give GetCursorPos ....
http://msdn.microsoft.com/en-us/library/0b1674x8.aspx (http://msdn.microsoft.com/en-us/library/0b1674x8.aspx)
A search for "cursor" in this forum is also a good way.
thank you for your help.
but i need to get hotspot of cursor icon. not a cursor location
You may need the file format for a cursor to get that info. A cursor editor can load that info when you edit a cursor so it must be contained in the file.
you can use GetIconInfo
however, when you call that function, it may create 0, 1, or 2 bitmaps
you should delete those objects when done
http://msdn.microsoft.com/en-us/library/windows/desktop/ms648070%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/ms648070%28v=vs.85%29.aspx)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms648052%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/ms648052%28v=vs.85%29.aspx)
http://msdn.microsoft.com/en-us/library/windows/desktop/dd183539%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/dd183539%28v=vs.85%29.aspx)
not tested
CharacterizeCursor PROTO :HINSTANCE,:LPCTSTR
CharacterizeCursor PROC hInst:HINSTANCE,lpCursorName:LPCTSTR
;Load Cursor and return handle and hotspot.
;May only be used for cursors that are standard size for the system (normally 32x32).
;Call With: hInstance = module handle (NULL for system cursors)
; lpCursorName = pointer to cursor name, or a system cursor constant
; To load a cursor from resource: hInst = module handle of current process
; lpCursorName = resource ordinal
;
; Returns: EAX = cursor handle (0 if error)
; ECX = hotspot X (-1 if error)
; EDX = hotspot Y (-1 if error)
;
;Also Uses: All other registers are preserved
;---------------------------------------------------------
;standard system cursor constants
;
;IDC_APPSTARTING Standard arrow and small hourglass
;IDC_ARROW Standard arrow
;IDC_CROSS Crosshair
;IDC_HAND Hand
;IDC_HELP Arrow and question mark
;IDC_IBEAM I-beam
;IDC_ICON Obsolete for applications marked version 4.0 or later.
;IDC_NO Slashed circle
;IDC_SIZE Obsolete for applications marked version 4.0 or later. Use IDC_SIZEALL.
;IDC_SIZEALL Four-pointed arrow pointing north, south, east, and west
;IDC_SIZENESW Double-pointed arrow pointing northeast and southwest
;IDC_SIZENS Double-pointed arrow pointing north and south
;IDC_SIZENWSE Double-pointed arrow pointing northwest and southeast
;IDC_SIZEWE Double-pointed arrow pointing west and east
;IDC_UPARROW Vertical arrow
;IDC_WAIT Hourglass
;ICONINFO STRUCT
; fIcon dd ?
; xHotspot dd ?
; yHotspot dd ?
; hbmMask HBITMAP ?
; hbmColor HBITMAP ?
;---------------------------------------------------------
LOCAL _iis :ICONINFO
;---------------------------------------------------------
INVOKE LoadCursor,hInst,lpCursorName
.if eax
push eax
INVOKE GetIconInfo,eax,addr _iis
.if eax
mov eax,_iis.hbmMask
.if eax
INVOKE DeleteObject,eax
.endif
mov eax,_iis.hbmColor
.if eax
INVOKE DeleteObject,eax
.endif
mov ecx,_iis.xHotspot
mov edx,_iis.yHotspot
.else
or ecx,-1
mov edx,ecx
.endif
pop eax
.else
or ecx,-1
mov edx,ecx
.endif
ret
CharacterizeCursor ENDP
Thank you very much @dedndave your code very helpful. I correct my codes. :t
and @hutch Thank you for correct the path