Dim proc As System.Diagnostics.Process
For Each proc In System.Diagnostics.Process.GetProcesses()
ListBox1.Items.Add("进程名称:" + proc.ProcessName + " 窗口名称:" + proc.MainWindowTitle)
Next
Private Sub GetOpenFormTitles()
Dim formTitles As New Collection
Try
For Each f As Form In My.Application.OpenForms
If Not f.InvokeRequired Then
' Can access the form directly.
formTitles.Add(f.Text)
End If
Next
Catch ex As Exception
formTitles.Add("Error: " & ex.Message)
End Try