Specifications

OLE reference
Gallagher & Robertson Glink: API reference manual 143
Dim gl As Glink.Auto
Private Function NextGlink(Name As String, Display As Boolean)
As Glink.Auto
Dim gl As Glink.Auto
Dim glnext As Glink.Auto
Dim S As String
Dim A As Boolean
Set NextGlink = Nothing
Set gl = GetObject("", "Glink.Auto")
If Not gl Is Nothing Then
A = gl.Automated
S = gl.Caption + "!" + Str(gl.Instance)
gl.ShowText (S)
If Display And (A = False) Then
List1.AddItem (S)
End If
If Name = "" Then
If A = True Then
Set NextGlink = gl
Else
Set NextGlink = NextGlink(Name, Display)
Set gl = Nothing
End If
Else
If Name = S Then
Set NextGlink = gl
Else
If A = True Then ' new session, close it
Set gl = Nothing
Else
Set NextGlink = NextGlink(Name, Display)
Set gl = Nothing
End If
End If
End If
End If
End Function
Private Sub StartNewGlink()
Set gl = NextGlink("", False)
If Not gl Is Nothing Then
MsgBox ("New Glink created, will terminate it now")
Set gl = Nothing
End If
End Sub
Private Sub ConnectToRunningGlink(Name As String)
Set gl = NextGlink(Name, False)
If Not gl Is Nothing Then
MsgBox ("Connected to " + Name)
Set gl = Nothing
End If
End Sub