View Single Post
  #5  
Old 05-24-2005, 16:44
goggles99 goggles99 is offline
Friend
 
Join Date: Aug 2004
Posts: 62
Rept. Given: 5
Rept. Rcvd 0 Times in 0 Posts
Thanks Given: 1
Thanks Rcvd at 4 Times in 4 Posts
goggles99 Reputation: 0
Arrow

hmm, for vb6 it can be done very simply using "App.PrevInstance".

Code:
Private Form_Load( )
     If App.PrevInstance Then
          Unload Me
     End If
End Sub
for vb.net it's a bit different, but this function should work
Code:
Function PrevInstance() As Boolean
If Ubound(Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess).ProcessName)) > 0 Then
     Return True 
Else 
     Return False  
End If
End Function
There is also a similar way to do it in vb.net here
http://www.thescarms.com/dotNet/SingleInstance.asp


Last edited by goggles99; 05-24-2005 at 16:47.
Reply With Quote