home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Programmer'…arterly (Limited Edition) / Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso / code / ch18code / vbterm.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-07-14  |  19.2 KB  |  617 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "MSComm Terminal "
  5.    ClientHeight    =   3216
  6.    ClientLeft      =   1596
  7.    ClientTop       =   3348
  8.    ClientWidth     =   7500
  9.    ForeColor       =   &H00000000&
  10.    Height          =   3828
  11.    Icon            =   "VBTERM.frx":0000
  12.    Left            =   1548
  13.    LinkMode        =   1  'Source
  14.    LinkTopic       =   "Form1"
  15.    ScaleHeight     =   3216
  16.    ScaleWidth      =   7500
  17.    Top             =   2784
  18.    Width           =   7596
  19.    Begin SysInfoLib.SysInfo SysInfo1 
  20.       Left            =   720
  21.       Top             =   2160
  22.       _version        =   65536
  23.       _extentx        =   804
  24.       _extenty        =   804
  25.       _stockprops     =   0
  26.    End
  27.    Begin RichtextLib.RichTextBox Term 
  28.       Height          =   1092
  29.       Left            =   840
  30.       TabIndex        =   2
  31.       Top             =   360
  32.       Width           =   1572
  33.       _Version        =   65536
  34.       _ExtentX        =   2773
  35.       _ExtentY        =   1926
  36.       _StockProps     =   69
  37.       BackColor       =   -2147483643
  38.       ScrollBars      =   3
  39.       TextRTF         =   $"VBTERM.frx":030A
  40.    End
  41.    Begin MSCommLib.MSComm MSComm1 
  42.       Left            =   108
  43.       Top             =   312
  44.       _Version        =   65536
  45.       _ExtentX        =   677
  46.       _ExtentY        =   677
  47.       _StockProps     =   0
  48.       CDTimeout       =   0
  49.       CommPort        =   1
  50.       CTSTimeout      =   0
  51.       DSRTimeout      =   0
  52.       DTREnable       =   -1  'True
  53.       Handshaking     =   0
  54.       InBufferSize    =   1024
  55.       InputLen        =   0
  56.       Interval        =   1000
  57.       NullDiscard     =   0   'False
  58.       OutBufferSize   =   512
  59.       ParityReplace   =   "?"
  60.       RThreshold      =   0
  61.       RTSEnable       =   0   'False
  62.       Settings        =   "9600,n,8,1"
  63.       SThreshold      =   0
  64.    End
  65.    Begin MSComDlg.CommonDialog OpenLog 
  66.       Left            =   120
  67.       Top             =   900
  68.       _Version        =   65536
  69.       _ExtentX        =   677
  70.       _ExtentY        =   677
  71.       _StockProps     =   0
  72.       CancelError     =   -1  'True
  73.       Color           =   12632256
  74.       DefaultExt      =   "LOG"
  75.       DialogTitle     =   "Open Communications Log File"
  76.       FileName        =   "*.log"
  77.       Filter          =   "*.log"
  78.    End
  79.    Begin VB.Label Label2 
  80.       BackColor       =   &H00C0C0C0&
  81.       Caption         =   "Status - "
  82.       Height          =   192
  83.       Left            =   120
  84.       TabIndex        =   1
  85.       Top             =   0
  86.       Width           =   732
  87.    End
  88.    Begin VB.Line Line1 
  89.       BorderColor     =   &H00808080&
  90.       BorderWidth     =   3
  91.       X1              =   0
  92.       X2              =   7320
  93.       Y1              =   240
  94.       Y2              =   240
  95.    End
  96.    Begin VB.Label Label1 
  97.       BackColor       =   &H00C0C0C0&
  98.       Height          =   192
  99.       Left            =   840
  100.       TabIndex        =   0
  101.       Top             =   0
  102.       Width           =   6612
  103.    End
  104.    Begin VB.Menu MFile 
  105.       Caption         =   "&File"
  106.       Begin VB.Menu MOpenLog 
  107.          Caption         =   "&Open Log File..."
  108.       End
  109.       Begin VB.Menu MCloseLog 
  110.          Caption         =   "&Close Log File"
  111.          Enabled         =   0   'False
  112.       End
  113.       Begin VB.Menu M3 
  114.          Caption         =   "-"
  115.       End
  116.       Begin VB.Menu MSendText 
  117.          Caption         =   "&Transmit Text File..."
  118.          Enabled         =   0   'False
  119.       End
  120.       Begin VB.Menu Bar2 
  121.          Caption         =   "-"
  122.       End
  123.       Begin VB.Menu MFileExit 
  124.          Caption         =   "E&xit"
  125.       End
  126.    End
  127.    Begin VB.Menu MEdit 
  128.       Caption         =   "&Edit"
  129.       Begin VB.Menu MCopy 
  130.          Caption         =   "&Copy"
  131.       End
  132.       Begin VB.Menu MPaste 
  133.          Caption         =   "&Paste"
  134.       End
  135.       Begin VB.Menu MSep1 
  136.          Caption         =   "-"
  137.       End
  138.       Begin VB.Menu MProperties 
  139.          Caption         =   "P&roperties"
  140.       End
  141.    End
  142.    Begin VB.Menu MPort 
  143.       Caption         =   "&CommPort"
  144.       Begin VB.Menu MOpen 
  145.          Caption         =   "Port &Open"
  146.       End
  147.       Begin VB.Menu MSettings 
  148.          Caption         =   "&Settings..."
  149.       End
  150.       Begin VB.Menu MBar1 
  151.          Caption         =   "-"
  152.       End
  153.       Begin VB.Menu MDial 
  154.          Caption         =   "&Dial Phone Number..."
  155.       End
  156.       Begin VB.Menu MHangup 
  157.          Caption         =   "&Hang Up Phone"
  158.          Enabled         =   0   'False
  159.       End
  160.    End
  161. Attribute VB_Name = "Form1"
  162. Attribute VB_Creatable = False
  163. Attribute VB_Exposed = False
  164. '--------------------------------------------------
  165. ' VBTerm - This is a demonstration program for the MSComm
  166. ' communications custom control.
  167. ' Copyright (c) 1994, Crescent Software, Inc.
  168. ' by Don Malin and Carl Franklin.
  169. '--------------------------------------------------
  170. DefInt A-Z
  171. Option Explicit
  172.                         
  173. Dim Ret                 ' Scratch integer.
  174. Dim Temp$               ' Scratch string.
  175. Dim hLogFile            ' Handle of open log file.
  176. Private Sub Form_Resize()
  177.    ' Resize the Term (display) control and status bar.
  178.    Line1.X2 = ScaleWidth
  179.    Term.Move 0, Line1.Y2 + 15, ScaleWidth, ScaleHeight - Line1.Y2 + 15
  180. End Sub
  181. Private Sub Form_Unload(Cancel As Integer)
  182.     Dim T&
  183.     If MSComm1.PortOpen Then
  184.        ' Wait 10 seconds for data to be transmitted.
  185.        T& = Timer + 10
  186.        Do While MSComm1.OutBufferCount
  187.           Ret = DoEvents()
  188.           If Timer > T& Then
  189.              Select Case MsgBox("Data cannot be sent", 34)
  190.                 ' Cancel.
  191.                 Case 3
  192.                    Cancel = True
  193.                    Exit Sub
  194.                 ' Retry.
  195.                 Case 4
  196.                    T& = Timer + 10
  197.                 ' Ignore.
  198.                 Case 5
  199.                    Exit Do
  200.              End Select
  201.           End If
  202.        Loop
  203.        MSComm1.PortOpen = 0
  204.     End If
  205.     ' If the log file is open, flush and close it.
  206.     If hLogFile Then MCloseLog_Click
  207.     End
  208. End Sub
  209. Private Sub MCloseLog_Click()
  210.    ' Close the log file.
  211.    Close hLogFile
  212.    hLogFile = 0
  213.    MOpenLog.Enabled = True
  214.    MCloseLog.Enabled = False
  215.    Form1.Caption = "MSComm Terminal"
  216. End Sub
  217. Private Sub MCopy_Click()
  218.     Clipboard.SetText Term.SelText, vbCFText
  219. End Sub
  220. ' OLE Automation: Changed Private to Public.
  221. Public Sub MDial_Click()
  222.     On Local Error Resume Next
  223.     Static Num$
  224.     ' Get a number from the user.
  225.     Num$ = InputBox$("Enter Phone Number:", "Dial Number", Num$)
  226.     If Num$ = "" Then Exit Sub
  227.     ' Call new DialNumber procedure.
  228.     DialNumber Num$
  229.     ' Move to new DialNumber procedure.
  230.     ' Open the port if it isn't already open.
  231.     'If Not MSComm1.PortOpen Then
  232.     '   MOpen_Click
  233.     '   If Err Then Exit Sub
  234.     'End If
  235.     ' Dial the number.
  236.     'MSComm1.Output = "ATDT" + Num$ + Chr$(13) + Chr$(10)
  237. End Sub
  238. ' New procedure bypasses user input for Dial method.
  239. Public Sub DialNumber(Num$)
  240.     On Local Error Resume Next
  241.     ' Open the port if it isn't already open.
  242.     If Not MSComm1.PortOpen Then
  243.        MOpen_Click
  244.        If Err Then Exit Sub
  245.     End If
  246.     ' Dial the number.
  247.     MSComm1.Output = "ATDT" + Num$ + Chr$(13) + Chr$(10)
  248. End Sub
  249. Private Sub MFileExit_Click()
  250.     ' Use Form_Unload since it has code to check for unsent data and an open log file.
  251.     Form_Unload Ret
  252. End Sub
  253. ' OLE Automation: Changed Private to Public.
  254. ' Toggle the DTREnable property to hang up the line.
  255. Public Sub MHangup_Click()
  256.     Ret = MSComm1.DTREnable     ' Save the current setting.
  257.     MSComm1.DTREnable = True    ' Turn DTR on.
  258.     MSComm1.DTREnable = False   ' Turn DTR off.
  259.     MSComm1.DTREnable = Ret     ' Restore the old setting.
  260. End Sub
  261. ' Display the value of the CDHolding property.
  262. Private Sub MHCD_Click()
  263.     If MSComm1.CDHolding Then
  264.         Temp$ = "True"
  265.     Else
  266.         Temp$ = "False"
  267.     End If
  268.     MsgBox "CDHolding = " + Temp$
  269. End Sub
  270. ' Display the value of the CTSHolding property.
  271. Private Sub MHCTS_Click()
  272.     If MSComm1.CTSHolding Then
  273.         Temp$ = "True"
  274.     Else
  275.         Temp$ = "False"
  276.     End If
  277.     MsgBox "CTSHolding = " + Temp$
  278. End Sub
  279. ' Display the value of the DSRHolding property.
  280. Private Sub MHDSR_Click()
  281.     If MSComm1.DSRHolding Then
  282.         Temp$ = "True"
  283.     Else
  284.         Temp$ = "False"
  285.     End If
  286.     MsgBox "DSRHolding = " + Temp$
  287. End Sub
  288. ' This procedure sets the InputLen property, which determines how
  289. ' many bytes of data are read each time Input is used
  290. ' to retreive data from the input buffer.
  291. ' Setting InputLen to 0 specifies that
  292. ' the entire contents of the buffer should be read.
  293. Private Sub MInputLen_Click()
  294.     On Error Resume Next
  295.     Temp$ = InputBox$("Enter New InputLen:", "InputLen", Str$(MSComm1.InputLen))
  296.     If Len(Temp$) Then
  297.         MSComm1.InputLen = Val(Temp$)
  298.         If Err Then MsgBox Error$, 48
  299.     End If
  300. End Sub
  301. ' Toggles the state of the port (open or closed).
  302. Public Sub MOpen_Click()
  303.     On Error Resume Next
  304.     Dim OpenFlag
  305.     MSComm1.PortOpen = Not MSComm1.PortOpen
  306.     If Err Then MsgBox Error$, 48
  307.     OpenFlag = MSComm1.PortOpen
  308.     MOpen.Checked = OpenFlag
  309.     MSendText.Enabled = OpenFlag
  310.     MHangup.Enabled = OpenFlag
  311. End Sub
  312. Private Sub MOpenLog_Click()
  313.    Dim replace
  314.    On Error Resume Next
  315.    ' Get the log filename from the user.
  316.    OpenLog.DialogTitle = "Open Communications Log File"
  317.    OpenLog.Filter = "Log Files (*.LOG)|*.log|All Files (*.*)|*.*"
  318.    Do
  319.       OpenLog.filename = ""
  320.       OpenLog.ShowOpen
  321.       If Err = cdlCancel Then Exit Sub
  322.       Temp$ = OpenLog.filename
  323.       ' If the file already exists, ask if the user wants to overwrite the file or add to it.
  324.       Ret = Len(Dir$(Temp$))
  325.       If Err Then
  326.          MsgBox Error$, 48
  327.          Exit Sub
  328.       End If
  329.       If Ret Then
  330.          replace = MsgBox("Replace existing file - " + Temp$ + "?", 35)
  331.       Else
  332.          replace = 0
  333.       End If
  334.    Loop While replace = 2
  335.    ' User clicked the Yes button, so delete the file.
  336.    If replace = 6 Then
  337.       Kill Temp$
  338.       If Err Then
  339.          MsgBox Error$, 48
  340.          Exit Sub
  341.       End If
  342.    End If
  343.    ' Open the log file.
  344.    hLogFile = FreeFile
  345.    Open Temp$ For Binary Access Write As hLogFile
  346.    If Err Then
  347.       MsgBox Error$, 48
  348.       Close hLogFile
  349.       hLogFile = 0
  350.       Exit Sub
  351.    Else
  352.       ' Go to the end of the file so that new data can be appended.
  353.       Seek hLogFile, LOF(hLogFile) + 1
  354.    End If
  355.    Form1.Caption = "MSComm Terminal - " + OpenLog.FileTitle
  356.    MOpenLog.Enabled = False
  357.    MCloseLog.Enabled = True
  358. End Sub
  359. ' This procedure sets the ParityReplace property, which holds the
  360. ' character that will replace any incorrect characters
  361. ' that are received because of a parity error.
  362. Private Sub MParRep_Click()
  363.     On Error Resume Next
  364.     Temp$ = InputBox$("Enter Replace Character", "ParityReplace", Form1.MSComm1.ParityReplace)
  365.     Form1.MSComm1.ParityReplace = Left$(Temp$, 1)
  366.     If Err Then MsgBox Error$, 48
  367. End Sub
  368. Private Sub MPaste_Click()
  369.     Term.SelText = Clipboard.GetText(vbCFText)
  370. End Sub
  371. Private Sub MProperties_Click()
  372.     frmProperties.Show 1
  373. End Sub
  374. ' This procedure sets the RThreshold property, which determines
  375. ' how many bytes can arrive at the receive buffer before the OnComm
  376. ' event is triggered and the CommEvent property is set to vbMSCommEvReceive.
  377. Private Sub MRThreshold_Click()
  378.     On Error Resume Next
  379.     Temp$ = InputBox$("Enter New RThreshold:", "RThreshold", Str$(MSComm1.RThreshold))
  380.     If Len(Temp$) Then
  381.         MSComm1.RThreshold = Val(Temp$)
  382.         If Err Then MsgBox Error$, 48
  383.     End If
  384. End Sub
  385. ' The OnComm event is used for trapping communications events and errors.
  386. Private Static Sub MSComm1_OnComm()
  387.     Dim EVMsg$
  388.     Dim ERMsg$
  389.     ' Branch according to the CommEvent property.
  390.     Select Case MSComm1.CommEvent
  391.         ' Event messages.
  392.         Case vbMSCommEvReceive
  393.             ShowData Term, (MSComm1.Input)
  394.         Case vbMSCommEvSend
  395.             
  396.         Case vbMSCommEvCTS
  397.             EVMsg$ = "Change in CTS Detected"
  398.         Case vbMSCommEvDSR
  399.             EVMsg$ = "Change in DSR Detected"
  400.         Case vbMSCommEvCD
  401.             EVMsg$ = "Change in CD Detected"
  402.         Case vbMSCommEvRing
  403.             EVMsg$ = "The Phone is Ringing"
  404.         Case vbMSCommEvEOF
  405.             EVMsg$ = "End of File Detected"
  406.         ' Error messages.
  407.         Case vbMSCommErBreak
  408.             EVMsg$ = "Break Received"
  409.         Case vbMSCommErCTSTO
  410.             ERMsg$ = "CTS Timeout"
  411.         Case vbMSCommErDSRTO
  412.             ERMsg$ = "DSR Timeout"
  413.         Case vbMSCommErFrame
  414.             EVMsg$ = "Framing Error"
  415.         Case vbMSCommErOverrun
  416.             ERMsg$ = "Overrun Error"
  417.         Case vbMSCommErCDTO
  418.             ERMsg$ = "Carrier Detect Timeout"
  419.         Case vbMSCommErRxOver
  420.             ERMsg$ = "Receive Buffer Overflow"
  421.         Case vbMSCommErRxParity
  422.             EVMsg$ = "Parity Error"
  423.         Case vbMSCommErTxFull
  424.             ERMsg$ = "Transmit Buffer Full"
  425.         Case Else
  426.             ERMsg$ = "Unknown error or event"
  427.     End Select
  428.     If Len(EVMsg$) Then
  429.         ' Display event messages in the label control.
  430.         Label1.Caption = EVMsg$
  431.         EVMsg$ = ""
  432.     ElseIf Len(ERMsg$) Then
  433.         ' Display error messages in an alert message box.
  434.         Beep
  435.         Ret = MsgBox(ERMsg$, 1, "Click Cancel to quit, OK to ignore.")
  436.         ERMsg$ = ""
  437.         ' If the user clicks Cancel (2)...
  438.         If Ret = 2 Then
  439.             MSComm1.PortOpen = 0    ' Close the port and quit.
  440.         End If
  441.     End If
  442. End Sub
  443. Private Sub MSendText_Click()
  444.    On Error Resume Next
  445.    Dim hSend, BSize, LF&
  446.    MSendText.Enabled = False
  447.    ' Get the text filename from the user.
  448.    OpenLog.DialogTitle = "Send Text File"
  449.    OpenLog.Filter = "Text Files (*.TXT)|*.txt|All Files (*.*)|*.*"
  450.    Do
  451.       OpenLog.filename = ""
  452.       OpenLog.ShowOpen
  453.       If Err = cdlCancel Then Exit Sub
  454.       Temp$ = OpenLog.filename
  455.       ' If the file doesn't exist, go back.
  456.       Ret = Len(Dir$(Temp$))
  457.       If Err Then
  458.          MsgBox Error$, 48
  459.          MSendText.Enabled = True
  460.          Exit Sub
  461.       End If
  462.       If Ret Then
  463.          Exit Do
  464.       Else
  465.          MsgBox Temp$ + " not found!", 48
  466.       End If
  467.    Loop
  468.    ' Open the log file.
  469.    hSend = FreeFile
  470.    Open Temp$ For Binary Access Read As hSend
  471.    If Err Then
  472.       MsgBox Error$, 48
  473.    Else
  474.       ' Display the Cancel dialog box.
  475.       CancelSend = False
  476.       Form2.Label1.Caption = "Transmitting Text File - " + Temp$
  477.       Form2.Show
  478.       
  479.       ' Read the file in blocks the size of the transmit buffer.
  480.       BSize = MSComm1.OutBufferSize
  481.       LF& = LOF(hSend)
  482.       Do Until EOF(hSend) Or CancelSend
  483.          ' Don't read too much at the end.
  484.          If LF& - Loc(hSend) <= BSize Then
  485.             BSize = LF& - Loc(hSend) + 1
  486.          End If
  487.       
  488.          ' Read a block of data.
  489.          Temp$ = Space$(BSize)
  490.          Get hSend, , Temp$
  491.       
  492.          ' Transmit the block.
  493.          MSComm1.Output = Temp$
  494.          If Err Then
  495.             MsgBox Error$, 48
  496.             Exit Do
  497.          End If
  498.       
  499.          ' Wait for all the data to be sent.
  500.          Do
  501.             Ret = DoEvents()
  502.          Loop Until MSComm1.OutBufferCount = 0 Or CancelSend
  503.       Loop
  504.    End If
  505.    Close hSend
  506.    MSendText.Enabled = True
  507.    CancelSend = True
  508.    Form2.Hide
  509. End Sub
  510. Private Sub MSettings_Click()
  511.     ' Show the communications settings form.
  512.     ConfigScrn.Show
  513. End Sub
  514. ' This procedure sets the SThreshold property, which determines
  515. ' how many characters (at most) have to be waiting
  516. ' in the output buffer before the CommEvent property
  517. ' is set to vbMSCommEvSend and the OnComm event is triggered.
  518. Private Sub MSThreshold_Click()
  519.     On Error Resume Next
  520.     Temp$ = InputBox$("Enter New SThreshold Value", "SThreshold", Str$(MSComm1.SThreshold))
  521.     If Len(Temp$) Then
  522.         MSComm1.SThreshold = Val(Temp$)
  523.         If Err Then MsgBox Error$, 48
  524.     End If
  525. End Sub
  526. ' This procedure adds data to the Term control's Text property.
  527. ' It also filters control characters, such as BACKSPACE,
  528. ' carriage return, and line feeds, and writes data to
  529. ' an open log file.
  530. ' BACKSPACE characters delete the character to the left,
  531. ' either in the Text property, or the passed string.
  532. ' Line feed characters are appended to all carriage
  533. ' returns.  The size of the Term control's Text
  534. ' property is also monitored so that it never
  535. ' exceeds 16384 characters.
  536. Private Static Sub ShowData(Term As Control, Dta$)
  537.     On Error Resume Next
  538.     Dim Nd, i
  539.     ' Make sure the existing text doesn't get too large.
  540.     Nd = LenB(Term.Text)
  541.     If Nd >= 16384 Then
  542.        Term.Text = Mid$(Term.Text, 4097)
  543.        Nd = LenB(Term.Text)
  544.     End If
  545.     ' Point to the end of Term's data.
  546.     Term.SelStart = Nd
  547.     ' Filter/handle BACKSPACE characters.
  548.     Do
  549.        i = InStr(Dta$, Chr$(8))
  550.        If i Then
  551.           If i = 1 Then
  552.              Term.SelStart = Nd - 1
  553.              Term.SelLength = 1
  554.              Dta$ = Mid$(Dta$, i + 1)
  555.           Else
  556.              Dta$ = Left$(Dta$, i - 2) + Mid$(Dta$, i + 1)
  557.           End If
  558.        End If
  559.     Loop While i
  560.     ' Eliminate line feeds.
  561.     Do
  562.        i = InStr(Dta$, Chr$(10))
  563.        If i Then
  564.           Dta$ = Left$(Dta$, i - 1) + Mid$(Dta$, i + 1)
  565.        End If
  566.     Loop While i
  567.     ' Make sure all carriage returns have a line feed.
  568.     i = 1
  569.     Do
  570.        i = InStr(i, Dta$, Chr$(13))
  571.        If i Then
  572.           Dta$ = Left$(Dta$, i) + Chr$(10) + Mid$(Dta$, i + 1)
  573.           i = i + 1
  574.        End If
  575.     Loop While i
  576.     ' Add the filtered data to the Text property.
  577.     Term.SelText = Dta$
  578.     ' Log data to file if requested.
  579.     If hLogFile Then
  580.        i = 2
  581.        Do
  582.           Err = 0
  583.           Put hLogFile, , Dta$
  584.           If Err Then
  585.              i = MsgBox(Error$, 21)
  586.              If i = 2 Then
  587.                 MCloseLog_Click
  588.              End If
  589.           End If
  590.        Loop While i <> 2
  591.     End If
  592. End Sub
  593. ' Keystrokes trapped here are sent to the MSComm
  594. ' control where they are echoed back via the
  595. ' OnComm (vbMSCommEvReceive) event, and displayed
  596. ' with the ShowData procedure.
  597. Private Sub Term_KeyPress(KeyAscii As Integer)
  598.     ' If the port is opened...
  599.     If MSComm1.PortOpen Then
  600.        ' Send the keystroke to the port.
  601.        MSComm1.Output = Chr$(KeyAscii)
  602.        ' Unless Echo is on, there is no need to
  603.        ' let the text control display the key.
  604.        If Not Echo Then KeyAscii = 0
  605.     End If
  606. End Sub
  607. Private Sub Term_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  608.     If SysInfo1.OSPlatform = 2 And Button = vbRightButton Then
  609.         PopupMenu MEdit, vbPopupMenuRightButton
  610.     End If
  611. End Sub
  612. Private Sub Term_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  613.     If SysInfo1.OSPlatform = 1 And Button = vbRightButton Then
  614.         PopupMenu MEdit, vbPopupMenuRightButton
  615.     End If
  616. End Sub
  617.