|
-
March 22nd, 1999, 02:45 AM
#1
URGENT : Avoiding multiple VB instances ??
How do I prevent running of multiple VB instances ?
Anand
-
March 22nd, 1999, 03:35 AM
#2
Re: URGENT : Avoiding multiple VB instances ??
Hi
Do you mean - multiple instances of your VB application, or multiple instances of Visual Basic itself ?
The first one is quite easy, the global App object in VB has a 'PrevInstance' property which lets you know if a previous instance of your application is running, eg.
Sub Main()
If App.PrevInstance Then
'
' Do nothing - or quit, whatever
'
Else
'
' Load the applications main form
'
Load mFrmMain
mFrmMain.Show
End If
End Sub
The second one would require a small vb app to be constantly running in the background, looking at all the top level windows running on the system. This way, you could kill off another instance of VB if it was running (it's a hack, but I don't know of any other way). I saw some code a while back which was designed to stop people running specified programs on their machines (eg. Solitaire, WinMine etc), I'll try and find it if you want.
Regards
Chris Eastwood
Codeguru - the website for developers
http://www.codeguru.com/vb
-
March 22nd, 1999, 03:57 AM
#3
Re: URGENT : Avoiding multiple VB instances ??
Hi Chris
I was looking for the first one. Thanks a lot
Anand
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|