Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
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
  #2  
Old 05-24-2005, 22:39
redbull redbull is offline
Friend
 
Join Date: Mar 2004
Posts: 160
Rept. Given: 17
Rept. Rcvd 5 Times in 4 Posts
Thanks Given: 3
Thanks Rcvd at 6 Times in 6 Posts
redbull Reputation: 5
if you use MUTEXes as suggested by "just4urim", be sure to release your mutex using a call to releaseMutex() before your program quits
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[C] NoDel (tool to prevent file deletion) Insid3Code Source Code 0 02-10-2015 16:38
Prevent browser from being killed nino General Discussion 4 01-10-2014 02:38


All times are GMT +8. The time now is 22:36.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )