Process.GetProcessesByName("進(jìn)程名")‘不帶擴(kuò)展名
目前創(chuàng)新互聯(lián)已為上千多家的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)絡(luò)空間、網(wǎng)站托管維護(hù)、企業(yè)網(wǎng)站設(shè)計(jì)、印臺(tái)網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長,共同發(fā)展。
找不到 就是沒有在運(yùn)行,但不知道能不能判斷已暫停狀態(tài)。
用process.GetProcesses()
或者process.GetProcessByid() 獲取進(jìn)程信息,
Imports System.Runtime.InteropServices
Module Module1
Sub Main()
Dim instance As Process = RunningInstance()
If instance IsNot Nothing Then
ShowWindowAsync(instance.MainWindowHandle, 3) '調(diào)用api函數(shù),正常顯示窗口
Return
End If
Dim F1 As New Form1
Application.Run(F1) '顯示窗體
End Sub
DllImport("User32.dll")
Public Function ShowWindowAsync(ByVal hWnd As System.IntPtr, ByVal cmdShow As Integer) As Boolean
End Function
Private Function RunningInstance() As Process '返回進(jìn)程中已經(jīng)打開的程序
Dim current As Process = Process.GetCurrentProcess()
Dim processes As Process() = Process.GetProcessesByName(current.ProcessName)
For Each process As Process In processes
If process.Id current.Id Then
If process.MainModule.FileName = current.MainModule.FileName Then
Return process
End If
End If
Next
Return Nothing
End Function
End Module