'先申明函数 Public Declare Function GetCursorInfo Lib "user32.dll" (ByRef pci As CURSORINFO) As Boolean '再建立需要用到的数据类型 CURSORINFO 及POINTAPI Public Type POINTAPI '建立point的属性,横坐标与纵坐标 X As Long 'point.x Y As Long 'point.y End Type Public Type CURSORINFO cbSize As Long ' Specifies the size, in bytes, of the structure. ' The caller must set this to Marshal.SizeOf(typeof(CURSORINFO)). flags As Long ' Specifies the cursor state. This parameter can be one of the following values: ' 0 The cursor is hidden. ' 1 The cursor is showing. hCursor As Long ' Handle to the cursor. ptScreenPos As POINTAPI End Type '最后调用此函数方法 DIM pci As CURSORINFO pci.cbSize = Len(pci) a = GetCursorInfo (pci) '如果调用成功则a返回True 否则返回False '如果调用成功可使用如下取得鼠标句柄等信息 pci.hcursor '鼠标句柄 pci.ptScreenPos.X '鼠标点x坐标 pci.ptScreenPos.Y '鼠标点y坐标
请哪位朋友帮帮忙可以吗?谢谢了。。。。。。 |