我想通过 API函数(GetWindowRect)获取我的子窗体和窗体窗体的高度、宽度等,能不能给我举个例子
如题,请帮帮忙
[解决办法]
Option ExplicitPrivate Type RECT Left As Long Top As Long Right As Long Bottom As LongEnd TypePrivate Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function GetWindowRect Lib "user32.dll " (ByVal hwnd As Long, ByRef lpRect As RECT) As LongPrivate Sub Command1_Click() Dim lngP As Long Dim meRECT As RECT lngP = FindWindow(vbNullString, "子窗体的标题") If lngP <> 0 Then lngP = GetWindowRect(lngP, meRECT) Debug.Print "宽:" & (meRECT.Right - meRECT.Left) * 15 Debug.Print "高:" & (meRECT.Bottom - meRECT.Top) * 15End Sub