田草博客

互联网田草博客


网友交流QQ群:11740834 需注明申请加入原因

微信 公众号:ByCAD

邮箱:tiancao1001x126.com
ByCAD,微信公众号
首页 | 普通 | 电脑 | AutoCAD | VB/VB.NET | FLash | 结构 | 建筑 | 电影 | BIM | 规范 | 软件 | ID
-随机-|-分布-
-博客论坛-|-﨣﨤﨧﨨-
-网站导航-|-规范下载-
-BelovedFLash欣赏-

用户登陆
用户:
密码:
 

站点日历
73 2024 - 3 48
     12
3456789
10111213141516
17181920212223
24252627282930
31


站点统计

最新评论



Vb.net Array.Reverse 反转元素 VB 怎样拖放某个文件到程序图标后用该程序打开
未知 VB遍历窗口及子窗口的控件   [ 日期:2018-06-25 ]   [ 来自:本站原创 ]  HTML
Private Const GW_CHILD = 5
Private Const GW_HWNDFIRST = 0
Private Const GW_HWNDNEXT = 2
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Private Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Sub FillChild(hWndParent As Long)
Dim hWndChild As Long
Dim szCaption As String
Dim buffer As String
Dim i As Long
hWndChild = GetWindow(hWndParent, GW_CHILD)
If (hWndChild = 0) Then Exit Sub
hWndChild = GetWindow(hWndChild, GW_HWNDFIRST)
If hWndChild = 0 Then Exit Sub
While (hWndChild <> 0)
szCaption = String$(255, 0)
GetClassName hWndChild, szCaption, 250
szCaption = Left$(szCaption, InStr(szCaption, String$(1, 0)) - 1)
buffer = CStr(hWndChild) & "--" & szCaption
i = GetWindowTextLength(hWndChild)
szCaption = String$(255, 0)
GetWindowText hWndChild, szCaption, 250
szCaption = Left$(szCaption, i)
buffer = buffer & "--" & szCaption
List1.AddItem buffer
FillChild hWndChild
hWndChild = GetWindow(hWndChild, GW_HWNDNEXT)
Wend
End Sub
Private Sub GetChildWindow(hwnd As Long)
Dim szCaption As String
Dim buffer As String
Dim i As Long
List1.Clear
szCaption = String$(255, 0)
GetClassName hwnd, szCaption, 250
szCaption = Left$(szCaption, InStr(szCaption, String$(1, 0)) - 1)
buffer = CStr(hwnd)
buffer = buffer & "--" & szCaption
i = GetWindowTextLength(hwnd)
szCaption = String$(255, 0)
GetWindowText hwnd, szCaption, 250
szCaption = Left$(szCaption, i)
buffer = buffer & "--" & szCaption
List1.AddItem buffer
FillChild hwnd
End Sub

Private Sub Command1_Click()
    GetChildWindow Me.hwnd
End Sub



VB6
【VB遍历窗口子窗口.rar】点击下载此文件




暂时没有评论
发表评论 - 不要忘了输入验证码哦!
作者: 用户:  密码:   注册? 验证:  防止恶意留言请输入问题答案:2*2=?  
评论:

禁止表情
禁止UBB
禁止图片
识别链接
识别关键字

字体样式 文字大小 文字颜色
插入粗体文本 插入斜体文本 插入下划线
左对齐 居中对齐 右对齐
插入超级链接 插入邮件地址 插入图像
插入 Flash 插入代码 插入引用
插入列表 插入音频文件 插入视频文件
插入缩进符合
点击下载按钮 下标 上标
水平线 简介分割标记
表  情
 
Tiancao Blog All Rights Reserved 田草博客 版权所有
Copyright ©