How to find running processes in VB.NET
I want to be able to cycle through the active processes on the system and find when my program starts? It has the name 'Calculate Distance' as the form1.vb text.
There fore, I want to be able to close a splash screen when the form1 loads. This requires checking curren开发者_如何学Pythontly running processes. How do I do that in VB.NET 2005?
Thanks in advance,
Catcalls
Try using the Process.GetProcessesByName() method in the System.Diagnostics
namespace.
bool processIsRunning = Process.GetProcessesByName("THE NAME OF YOUR PROCSS").Length > 0;
use this easy code snipit VB 2010
Imports System.Net
Imports System.IO
If Process.GetProcessesByName("name of process without .extension").Length > 0 Then
chekrun = 3
Else
chekrun = 10
End If
精彩评论