VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form CID 
   BorderStyle     =   1  '固定(実線)
   Caption         =   "USBCID4-JP"
   ClientHeight    =   3210
   ClientLeft      =   150
   ClientTop       =   375
   ClientWidth     =   6990
   BeginProperty Font 
      Name            =   "MS UI Gothic"
      Size            =   9
      Charset         =   128
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "cid4.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3210
   ScaleWidth      =   6990
   StartUpPosition =   3  'Windows の既定値
   Begin VB.Timer Timer11 
      Left            =   3240
      Top             =   600
   End
   Begin VB.CommandButton hang1 
      Caption         =   "停止"
      Height          =   330
      Left            =   5760
      TabIndex        =   7
      Top             =   2760
      Width           =   1080
   End
   Begin VB.TextBox Tx1Number 
      Appearance      =   0  'ﾌﾗｯﾄ
      Height          =   270
      Left            =   1680
      TabIndex        =   4
      Text            =   "0120-000-000"
      Top             =   2760
      Width           =   1935
   End
   Begin VB.Timer Timer1 
      Left            =   3240
      Top             =   120
   End
   Begin VB.TextBox Tx1Port 
      Appearance      =   0  'ﾌﾗｯﾄ
      Height          =   270
      Left            =   120
      TabIndex        =   2
      Text            =   "3"
      Top             =   2760
      Width           =   480
   End
   Begin VB.CommandButton dial1 
      Caption         =   "発信"
      Height          =   330
      Left            =   4560
      TabIndex        =   1
      Top             =   2760
      Width           =   1080
   End
   Begin MSCommLib.MSComm MSComm1 
      Left            =   3120
      Top             =   1440
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DTREnable       =   -1  'True
      RThreshold      =   1
   End
   Begin RichTextLib.RichTextBox Rx1 
      Height          =   2490
      Left            =   90
      TabIndex        =   0
      Top             =   105
      Width           =   3315
      _ExtentX        =   5847
      _ExtentY        =   4392
      _Version        =   393217
      Enabled         =   -1  'True
      ScrollBars      =   2
      Appearance      =   0
      TextRTF         =   $"cid4.frx":0442
   End
   Begin RichTextLib.RichTextBox Tx1 
      Height          =   2490
      Left            =   3480
      TabIndex        =   3
      Top             =   120
      Width           =   3405
      _ExtentX        =   6006
      _ExtentY        =   4392
      _Version        =   393217
      Enabled         =   -1  'True
      ScrollBars      =   2
      Appearance      =   0
      TextRTF         =   $"cid4.frx":04DB
   End
   Begin VB.Label Label1 
      Caption         =   "発信番号"
      Height          =   195
      Left            =   3720
      TabIndex        =   6
      Top             =   2760
      Width           =   855
   End
   Begin VB.Label Label3 
      Caption         =   "COMポート"
      Height          =   195
      Left            =   720
      TabIndex        =   5
      Top             =   2760
      Width           =   855
   End
End
Attribute VB_Name = "CID"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


Private Sub Form_Load()
    Timer1.Interval = 2000 '2秒ごと割り込み
    Timer11.Interval = 100 '0.1秒ごと割り込み
    Timer1.Enabled = False
    Timer11.Enabled = False
End Sub
Public Function init1com()
    If MSComm1.PortOpen = False Then
        MSComm1.CommPort = Val(Tx1Port) 'COMポート番号
        MSComm1.Settings = "38400,N,8,1"
        MSComm1.RThreshold = 1 'イベント（MSComm1_OnComm）を設定した受信バイト数で発生
        MSComm1.InputLen = 0 '受信するバイト数　（0=全て)
        MSComm1.PortOpen = True
    End If
End Function
Public Function end1com()
    If MSComm1.PortOpen = True Then
        Tx1out ("/H00" + vbCrLf)
        MSComm1.PortOpen = False
    End If
End Function
Private Sub MSComm1_OnComm()
    Rx1.Text = Rx1.Text + "(" + Format(Now, "hh:nn:ss") + ") " + MSComm1.Input
End Sub
Public Function Tx1out(ByVal x$)
    MSComm1.Output = x$
    Tx1.Text = Tx1.Text + "(" + Format(Now, "hh:nn:ss") + ") " + x$
End Function
Private Sub Form_unLoad(Cancel As Integer)
    end1com
    Unload Me
End Sub

Private Sub dial1_Click()
    Rx1.Text = ""
    init1com
    Timer1.Enabled = True
    Timer11.Enabled = True
End Sub
Private Sub hang1_Click()
    end1com
End Sub

Private Sub Timer1_Timer()
    On Error Resume Next
    Rx1.Text = ""
    Tx1out ("/S" + vbCrLf)
End Sub
Private Sub Timer11_Timer()
    On Error Resume Next
    If InStr(1, Rx1.Text, "RING:OFF") <> 0 And InStr(1, Rx1.Text, "DIAL:OFF") <> 0 Then
        Tx1out ("/H11" + vbCrLf)
        Tx1out ("/D,,," + Tx1Number.Text + vbCrLf)
        Timer1.Enabled = False
        Timer11.Enabled = False
    End If
End Sub
