可以從獲取當前過程的名稱為開始,你可以通過調用過程對象的GetCurrentProcess方法來達到這一目的。這是一個公共的方法,所以無需建立一個過程對象的實例。 Dim strProcessName As String strProcessName = Diagnostics.Process.GetCurrentProcess.ProcessName If Diagnostics.Process.GetProcessesByName( _ strProcessName).Length > 1 Then 注釋:More than one instance was found End If 當你想確認用戶只運行程序的一個結果時,這一方法非常有用。 |