VB获取窗口内某一点的坐标

来源:百度知道 编辑:UC知道 时间:2024/09/28 08:13:04
求能够获取在指定某窗口内某一点的坐标!!
PS:指定某窗口内~~~~不是整个屏幕!请看仔细,谢谢了!!
PS:主要用于获取其他窗口内某一点的坐标,
Private Sub Form_MouseUp
这样不是只能在form窗体点击才有用?那有什么意义?不明白?

PSPSPSP:
是我没听懂还是你们没听懂呢?
我要的是获取指定的其他窗口(比如说蜘蛛纸牌里)的某一点坐标,
你们这样不是只能获取在这个VB工程窗体里的某一点,这并不是我要的!?

窗体中加入一个Timer,代码如下:

Private Declare Function GetWindowPlacement Lib "user32" (ByVal hwnd As Long, lpwndpl As WINDOWPLACEMENT) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type WINDOWPLACEMENT
Length As Long
flags As Long
showCmd As Long
ptMinPosition As POINTAPI
ptMaxPosition As POINTAPI
rcNormalPosition As RECT
End Type

Private Sub Form_Load()
Timer1.Interval = 15
End Sub

Private Sub Timer1_Timer()
Dim pt As POINTAPI
Dim wfp As WINDOWPLACEMENT
Dim myhwnd As Long
Dim r As Long
Ge