我給你一個(gè)簡(jiǎn)單的思路:
創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),將樂企業(yè)網(wǎng)站建設(shè),將樂品牌網(wǎng)站建設(shè),網(wǎng)站定制,將樂網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,將樂網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。
1,定義5個(gè)公共布爾變量,用來記錄5個(gè)線程的執(zhí)行情況
2,線程開始變量賦值假,執(zhí)行完畢或者異常退出賦值真
3,一直用一個(gè)定時(shí)器掃描5個(gè)公共布爾變量----------隨時(shí)知道狀態(tài)
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
用process.GetProcesses()
或者process.GetProcessByid() 獲取進(jìn)程信息,