以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]遍历窗口  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=142651)

--  作者:江南小镇
--  发布时间:2019/11/2 19:54:00
--  [求助]遍历窗口
老师好,下面代码不能遍历模式窗口和DropDownForm的控件。


Dim tv As WinForm.TreeView = Args(0)
tv.Nodes.Clear
Dim nd As WinForm.TreeNode
Dim name As String
Dim sname() As String
For Each f As WinForm.Form In Forms
    name = f.Category
    sname = name.Split("\\")
    Dim frmnd As WinForm.TreeNode
    If sname.Length = 1 AndAlso sname(0) = "" Then
        frmnd = tv.Nodes.Add(f.name)
    Else
        If tv.Nodes.Contains(sname(0)) = False Then
            nd = tv.Nodes.Add(sname(0))
        Else
            nd = tv.Nodes(sname(0))
        End If
        For i As Integer = 1 To sname.Length - 1
            If nd.Nodes.Contains(sname(i)) = False Then
                nd = nd.Nodes.Add(sname(i))
            Else
                nd = nd.Nodes(sname(i))
            End If
        Next
        frmnd = nd.Nodes.Add(f.name)
    End If
    Dim opened = f.Opened
    f.Open
    For Each c As object In f.controls
        try
            frmnd.Nodes.Add(c.name, c.name & " | " & c.Text)
        catch ex As exception
            frmnd.Nodes.Add(c.name)
        End try
    Next
    If opened = False Then f.Close
Next




--  作者:有点蓝
--  发布时间:2019/11/3 20:01:00
--  
确实没有办法遍历。把这些窗口都改为独立窗口再遍历