用process.GetProcesses()
我們提供的服務(wù)有:成都網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、佛坪ssl等。為1000多家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的佛坪網(wǎng)站制作公司
或者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
打開VS.net
2008
,打開工程,點(diǎn)擊菜單項(xiàng)目
在點(diǎn)XX屬性,就可以看到啟動(dòng)對象,選擇相應(yīng)的啟動(dòng)模塊