新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
Process.GetProcessesByName("进程名")‘不带扩展名
目前创新互联已为上千多家的企业提供了网站建设、域名、网络空间、网站托管维护、企业网站设计、印台网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
找不到 就是没有在运行,但不知道能不能判断已暂停状态。
用process.GetProcesses()
或者process.GetProcessByid() 获取进程信息,
Imports System.Runtime.InteropServices
Module Module1
Sub Main()
Dim instance As Process = RunningInstance()
If instance IsNot Nothing Then
ShowWindowAsync(instance.MainWindowHandle, 3) '调用api函数,正常显示窗口
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 '返回进程中已经打开的程序
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