AddOn: Prevent from loading more than once
I appreciate you patience as I resurrect this topic since it has become an
increasing concern here. We need a way to restrict our AddOn from "being in"
Task.mgr more than once. We are working with Terminal Services. A couple ways we have found more than one instance in TM is the User just opening another session or opening another session after a "problem/Issue/Crash".
I have this code which restricts the AddOn from starting more than once here on my local machine:
Public Sub Main()
Dim x As Integer = 0
Dim Ctr As Integer = 0
Dim som() As System.Diagnostics.Process
som = System.Diagnostics.Process.GetProcesses
Dim Name As String
For x = 0 To som.Length - 1
Name = som(x).ProcessName.ToUpper
If som(x).ProcessName = "Test.Enhance" Then
Ctr += 1
If Ctr > 0 Then
MsgBox("LBSI.Enhance AddOn is already started...Exiting application.", MsgBoxStyle.Critical)
Catch ex As Exception
HandleException("Main", ex, True)
Is there a better more elegant way to do this? How about for Terminal Services?
Thanks in advance for your insight,