Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

AddOn: Prevent from loading more than once

Good Afternoon


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

End If

Next x

If Ctr > 0 Then

MsgBox("LBSI.Enhance AddOn is already started...Exiting application.", MsgBoxStyle.Critical)

Exit Try




End If

Catch ex As Exception

HandleException("Main", ex, True)

End Try

End Sub

Is there a better more elegant way to do this? How about for Terminal Services?

Thanks in advance for your insight,


Former Member
Not what you were looking for? View more on this topic or Ask a question