Why
It might be interesting, in case you inadvertently call a second occurrence of the
program,
that is merely puts back into foreground the (forgotten) first one.
When 2 Reliable start stealing each other's work files, you land into some trouble.
I developed the module, and you can see I used it in some other applications of mine.
I did not re-incorporate it in my latest version of Reliable, as I do not restart Reliable
every 5 minutes and I got more careful.
How
Be sure your App.Title
(as supplied in Project|Properties|Create|Title)
(or seen in your .vbp under KeyWord: Title=".....")
is UNIQUE
Just reference the two supplied
modules:
Module_PreviousInstanceActivate.bas
Module_RTrimNull.bas
in your .vbp file.
When your form loads, you add something like:
'############################################################################################ Private Sub Form_Load() '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Me.Left = (Screen.Width - Me.Width) / 2 Me.Top = (Screen.Height - Me.Height) / 2 Me.Caption = App.Title '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If App.PrevInstance Then Call PreviousInstanceActivate(Me) Unload Me Exit Sub End If '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ..... '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End Sub '############################################################################################ |
Back to Root Index or Root Main Pages