1个回答
2013-12-03
展开全部
Private Type Rect ' Rect类型声明
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32.dll" _
(ByVal hwnd As Long, lpRect As Rect) As Long ' api声明
Private Sub Command1_Click()
Dim r As Rect
Dim retval As Long
retval = GetWindowRect(Form1.hwnd, r) ' 获取当前窗体的Rect
s = "Width =" & (r.Right - r.Left) & " Height =" & (r.Bottom - r.Top) ' 算出窗体的高和宽
MsgBox s
End Sub
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function GetWindowRect Lib "user32.dll" _
(ByVal hwnd As Long, lpRect As Rect) As Long ' api声明
Private Sub Command1_Click()
Dim r As Rect
Dim retval As Long
retval = GetWindowRect(Form1.hwnd, r) ' 获取当前窗体的Rect
s = "Width =" & (r.Right - r.Left) & " Height =" & (r.Bottom - r.Top) ' 算出窗体的高和宽
MsgBox s
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询