首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

小弟我想通过 API函数(GetWindowRect)获取小弟我的子窗体和窗体窗体的高度、宽度等,能不能给小弟我举个例子

2012-03-04 
我想通过 API函数(GetWindowRect)获取我的子窗体和窗体窗体的高度、宽度等,能不能给我举个例子如题,请帮帮

我想通过 API函数(GetWindowRect)获取我的子窗体和窗体窗体的高度、宽度等,能不能给我举个例子
如题,请帮帮忙

[解决办法]

VB code
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 

热点排行