Check if application already running in VB .NET
Posted on 2004-09-28
The App.PrevInstance function is deprecated and no longer usable in .NET. There is no equivalent, but the same result can be obtained via:
Public Function PrevInstance() As Boolean
If Diagnostics.Process.GetProcessesByName _
.Length > 1 Then
My problem is that whenever I make a call to the Diagnostics.Process.xxx objects, my application stalls and needs to be manually end tasked. For trouble shooting purposes I have tried:
This also freezes the application. Even a completely empty application with only one form and with this msgbox line in the form load function freezes. Any ideas?
On another note, my application is one that runs solely in the system tray as a system tray icon, with no visible windows. The way I have accomplished this is by setting the form that loads with the project to start minimized and then doing me.hide() on form load. Is this a good/the right way to do this?