VB 6获取鼠标当前位置API

存档信息。

以前写一个控制自定义窗口缩放的控件的时候用过,今天用怎么也想不起来。找出源代码,原来如此:

Private Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As Long

Private Type PointAPI
      X As Long
      Y As Long
End Type

使用:

Dim ScreenPoint As PointAPI
GetCursorPos ScreenPoint

换算为Twips:

Screen.TwipsPerPixelX * ScreenPoint.X
Screen.TwipsPerPixelY * ScreenPoint.Y

原文地址:https://www.cnblogs.com/maweifeng/p/272885.html