十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
用process.GetProcesses()
我们提供的服务有:成都网站建设、成都网站设计、微信公众号开发、网站优化、网站认证、佛坪ssl等。为1000多家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的佛坪网站制作公司
或者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
打开VS.net
2008
,打开工程,点击菜单项目
在点XX属性,就可以看到启动对象,选择相应的启动模块