My app needs to check and see if it is already running when launching so it doesn't open a second time. I have a system tray icon that can make the application visible = False. Works great. However, I need to make sure the user looks at the system tray for the notifyicon if the app is already running.
Private Sub mainWindowSmall_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim p() As Process
p = Process.GetProcessesByName("TSC Tool Box")
If p.Count > 0 Then
MessageBox.Show("The TSC Tool Box is already running. Check System tray!", _
"Warning !!!", MessageBoxButtons.OK, _
MessageBoxIcon.Error, MessageBoxDefaultButton.Button2)
Me.Close()
Else
totalOnLoad()
End If
End Sub
VB.NET | winforms