VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2736
   ClientLeft      =   1092
   ClientTop       =   2340
   ClientWidth     =   6024
   BeginProperty Font 
      Name            =   "Terminal"
      Size            =   7.2
      Charset         =   255
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   2736
   ScaleWidth      =   6024
   Begin VB.TextBox GetText 
      BeginProperty Font 
         Name            =   "Courier New"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   330
      Left            =   540
      TabIndex        =   1
      Top             =   480
      Width           =   5355
   End
   Begin VB.TextBox DoText 
      BeginProperty Font 
         Name            =   "Courier New"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Left            =   540
      TabIndex        =   0
      Top             =   60
      Width           =   5355
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "Courier New"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1695
      Left            =   120
      MultiLine       =   -1  'True
      TabIndex        =   2
      Top             =   960
      Width           =   5775
   End
   Begin VB.Label Label2 
      Caption         =   "Do:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   7.8
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   120
      Width           =   255
   End
   Begin VB.Label Label1 
      Caption         =   "Get:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   7.8
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   3
      Top             =   540
      Width           =   315
   End
   Begin VB.Menu mnuOptions 
      Caption         =   "&Options"
      Begin VB.Menu mnuEXE 
         Caption         =   "&EXE"
         Checked         =   -1  'True
      End
      Begin VB.Menu mnuDLL 
         Caption         =   "&DLL"
      End
      Begin VB.Menu mnuSep1 
         Caption         =   "-"
      End
      Begin VB.Menu mnuShow 
         Caption         =   "&Show"
      End
      Begin VB.Menu mnuLog 
         Caption         =   "&Log"
      End
      Begin VB.Menu mnuSep2 
         Caption         =   "-"
      End
      Begin VB.Menu mnuExit 
         Caption         =   "E&xit"
      End
   End
   Begin VB.Menu mnuHelp 
      Caption         =   "&Help"
      Begin VB.Menu mnuAbout 
         Caption         =   "&About"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub JOLEClose()
On Error GoTo Fini
Fini: End
End Sub

Private Sub mnuAbout_Click()
LF = Chr$(10)
LF2 = LF & LF
t = ""
t = t & "Demo of J OLE Server" & LF2
t = t & "Do:  send expression to J" & LF
t = t & "Get: send expression to J, display result" & LF2
t = t & "Options menu:" & LF
t = t & "  select EXE for JEXE server" & LF
t = t & "  select DLL for JDLL server" & LF2
t = t & "  select Show to display JEXE session (ignored by DLL)" & LF
t = t & "  select Log to display JEXE log (ignored by DLL)" & LF
About!lblAbout.Caption = t
About.Show 1
End Sub

Private Sub mnuDLL_Click()
If mnuDLL.Checked = False Then SetDLL
End Sub

Private Sub DoText_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    KeyAscii = 0
    ec = js.Do(DoText)
    DoText.SelStart = 0
    DoText.SelLength = Len(DoText.Text)
    If ec Then
      js.ErrorText ec, v
      Text1 = v
    End If
End If
End Sub

Private Sub mnuEXE_Click()
If mnuEXE.Checked = False Then SetEXE
End Sub

Private Sub Exit_Click(Index As Integer)
On Error GoTo Fini
js.Quit
Fini: End
End Sub

Private Sub SetEXE()
Form1.Caption = "J OLE - EXE Server"
jinit 1
If mnuShow.Checked = True Then js.Show (1)
If mnuLog.Checked = True Then js.Log (1)
mnuEXE.Checked = True
mnuDLL.Checked = False
mnuShow.Enabled = True
mnuLog.Enabled = True
End Sub

Private Sub SetDLL()
Form1.Caption = "J OLE - DLL Server"
jinit 0
mnuDLL.Checked = True
mnuEXE.Checked = False
mnuShow.Enabled = False
mnuLog.Enabled = False
End Sub

Private Sub Form_Load()
SetEXE
End Sub

Private Sub GetText_KeyPress(KeyAscii As Integer)
Dim X As Variant
Dim v As Variant
If KeyAscii = 13 Then
  KeyAscii = 0
  ec = js.Do("JGet=. " & GetText)
  If ec Then
    js.ErrorText ec, v
    Text1 = v
  Else
    ec = js.GetB("JGet", X)
    GetText.SelStart = 0
    GetText.SelLength = Len(GetText.Text)
    If ec Then
      js.ErrorText ec, v
      Text1 = v
    Else
      jdisplay X, Text1
    End If
  End If
End If
End Sub

Private Sub mnuExit_Click()
JOLEClose
End Sub

Private Sub mnuLog_Click()
mnuLog.Checked = Not mnuLog.Checked
If mnuLog.Checked Then
  js.Log (1)
Else
  js.Log (0)
End If
End Sub

Private Sub mnuShow_Click()
mnuShow.Checked = Not mnuShow.Checked
If mnuShow.Checked Then
  js.Show (1)
Else
  js.Show (0)
End If
End Sub
