VB获得怎么根据句柄获得一个程序的窗口大小??

来源:百度知道 编辑:UC知道 时间:2024/06/20 03:05:08
如题了。。。想知道1个程序的窗口的大小····

Private Type rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As rect) As Long

Private Sub Command1_Click()
Dim rect As rect

GetWindowRect Me.hwnd, rect

'宽度: rect.Right - rect.Left, 高度:rect.Bottom - rect.Top
Print rect.Right - rect.Left, rect.Bottom - rect.Top
End Sub