如何捕获鼠标的形状
如何获取鼠标当前的形状,是获得另外一个程序中的鼠标的形状,如鼠标移动到另一个程序中打开的一组图片时,鼠标经过作何一个图片上时就会改变形状,我想要捕获这个,不是获得鼠标的坐标哦
[解决办法]
我来回答,不过分要全给我哦... -_-||
我直接说一个全局的获取当前鼠标样式的代码吧
有关的API:
Type POINTAPI '代表鼠标指针当前位置的一个结构
X As Long
Y As Long
End Type
Private Type CURSORINFO '获得鼠标信息内容
cbSize As Long '本结构大小
flags As Long '附加参数
hCursor As Long '获取的鼠标句丙
ptScreenPos As POINTAPI '鼠标当前的坐标
End Type
Private Declare Function CopyIcon Lib "user32 " (ByVal hIcon As Long) As Long
'复制一个鼠标/图标的句丙
Private Declare Function DrawIcon Lib "user32 " (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal hIcon As Long) As Long
'将鼠标样式画出来
Private Declare Function DestroyCursor Lib "user32 " (ByVal hCursor As Long) As Long
'将不用的鼠标句丙释放
Private Declare Function GetCursorInfo Lib "user32 " (pci As CURSORINFO) As Long
'获取系统内当前鼠标的信息
sub DrawCursorImage(Hdc as long)
dim CursorPar as CURSORINFO
GetCursorInfo CursorPar
dim iCursor as long
iCursor = CopyIcon (CursorPar.hCursor)
DrawIcon Hdc,10,10,iCursor
DestroyCursor iCursor
end sub
手动写的代码难免出错,请自改之,但这个代码和用的API是没错的