'************* 1: Prevent procedures from opening ***************************** i i i 功 功 功Can: judgment if the project is running 'parameters: no' return value: True has run FALSE un Running '************************* ************************************************************** PUBLIC FUNSINSTANCERUNNING () AS Boolean Dim Current As Process = System.Diagnostics.Process.getCurrentProcess () DIM processes As Process () = System.Diagnostics.Process.GetProcessesByName (current.ProcessName) 'Loop through the running processes in with the same name Dim p As Process For Each p in processes' Ignore the current process If p.Id <> current .Id Then 'Make sure that the process is running from the exe file. If System.Reflection.Assembly.GetExecutingAssembly (). Location.Replace ( "/", "/") = current.MainModule.FileName Then' Return the other Process Instance. Return True End If End 'No Other i NSTANCE WAND, RETURN NULL. RETURN FALSEEND FUNCTION 'RUNNINSTANCE
'**************** Method 2: Prevent procedures from opening *************************************************************** Imports System.Diagnostics if Ubound Process.getProcesSbyName (Process.getCurrentProcess.ProcessName) )_> 0 THEN Ext Sub'Process.getCurrentProcess.ProcessName Gets the name of the current runner.