这是我的代码:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim proc As New EnumWindProc(AddressOf EnumChild), i As Int32
Dim hwnd() As Process = Process.GetProcesses
Dim FormTitle As String
Dim RetVal As Integer
For i = 0 To hwnd.GetUpperBound(0)
Children = String.Empty
EnumChildWindows(hwnd(i).MainWindowHandle, proc, IntPtr.Zero)
RetVal = GetWindowText(hwnd(i).Handle, FormTitle, Int16.MaxValue)
ListBox1.Items.Add(FormTitle & " " & hwnd(i).ToString & Convert.ToChar(Keys.Return) & Children)
Next i
End Sub
出于某种原因,我只得到前两行窗口。如果我删除 GetWindowTest 代码行,我会得到所有窗口,但没有标题。
我怎样才能解决这个问题?