If
UBound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0 Then
' MsgBox("Application is already running...",
MsgBoxStyle.Information, Application.ProductName)
ActivatePrevInstance("frmswitchboard")
end if
If you just want to make sure you don't start another instance of an app,
you can use the GetProcessesByName. There can be issues with this, particularly
in a Terminal Server environment however. Search on "Single Instance" for
more information. My write up with a VB solution is available at http://devauthority.com/blogs/jwooley/archive/2005/07/28/318.aspx.
this was my solution this is Terminal server safe and you may use this
optional ( for instance from a config file )
cause sometimes you might want to have your proggy started with multiple
instances in some situations
regards
Michel Posseth [MCP]
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.