|
|
Title | Allow only one instance of a program |
Keywords | instance, program |
Categories | Tips 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
|
|
|
|
|
|