
加好友 发短信
等级:超级版主
帖子:112380
积分:572162
威望:0
精华:9
注册:2015/6/24 9:21:00
|
Post By:2019/11/13 15:13:00 [显示全部帖子]
全局代码 Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As IntPtr, ByRef lpRect As RECT) As Long Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer Public Structure RECT Public left As Int32 Public top As Int32 Public right As Int32 Public bottom As Int32 End Structure Public Sub Button1_Click() Dim p1 As RECT Dim hwnd As IntPtr = FindWindow(Nothing, "无标题 - 记事本") If hwnd <> IntPtr.Zero Then GetWindowRect(Me.Handle, p1) MsgBox(p1.right) '获取到left ,top ,right ,bottom Else MsgBox("未找到窗口") End If End Sub
调用 Button1_Click()
|
|