How do I get list of Process Names running, in VB.NET?

前端 未结 4 1526
轮回少年
轮回少年 2020-12-11 03:04

I am trying to find out if an instance of an application (not vb.net) is already running - because I will want to start it but I don\'t want to start it if it is already run

4条回答
  •  生来不讨喜
    2020-12-11 03:48

    another way:

        Dim psList() As Process
        Try
            psList = Process.GetProcesses()
    
            For Each p As Process In psList
                Console.WriteLine(p.Id.ToString() + " " + p.ProcessName)
            Next p
    
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
        Console.ReadKey()
    

提交回复
热议问题