debugging打印所有的应用程序名称

是否有可能在debug.print中列出所有打开的应用程序?

我试了下面的代码,不工作。

Dim app As Application For Each app In Windows.Applications Debug.Print app.Name Next app 

尝试这样的事情。

 Dim strComputer As String Dim objWMIService As Variant Dim colItems As Variant Dim objItem As Variant strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Process", , 48) For Each objItem In colItems Debug.Print objItem.ProcessId & " " & objItem.Name & " " & objItem.Caption & " " & objItem.CommandLine & " " & objItem.ExecutablePath Next