用API取得一个程序的屏幕坐标位置 VB问题
来源:百度知道 编辑:UC知道 时间:2024/05/28 13:50:37
用API取得一个程序的屏幕坐标位置 VB问题
如题。
一个小时后来视察,结果满意直接散分~~
谢谢各位~。
如题。
一个小时后来视察,结果满意直接散分~~
谢谢各位~。
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function GetWindowRect Lib "user32" Alias "GetWindowRect" (ByVal hwnd As Long, lpRect As RECT) As Long
Dim Handle As Long
Private Sub Command1_Click()
Dim Rect As RECT
GetWindowRect Handle, Rect
'Rect 的值 Left, Top 就是句柄 Handle 所指窗体 左上角的位置
End Sub
先的到窗口句柄,如用findwindow函数,再用GetWindowRect函数的到窗口坐标