Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleAllow only one instance of a program
Keywordsinstance, program
CategoriesTips and Tricks, Windows
 
Thanks to C. K. Lam.

Use App.PrevInstance to see if a previous instance is already running.

 
Private Sub Form_Load()
    ' See if there is already and instance.
    If App.PrevInstance Then
        ' Activate the previous instance
        AppActivate App.Title

        ' Send a key (here SHIFT-key) to set the
        ' form from the previous instance to the
        ' top of the screen.
        SendKeys "+", True

        ' Terminate the new instance
        Unload Me
    End If
End Sub
 
Formatted by Neil Crosby
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated