VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "CommSMSLib Example1"
   ClientHeight    =   5868
   ClientLeft      =   48
   ClientTop       =   336
   ClientWidth     =   5760
   LinkTopic       =   "Form1"
   ScaleHeight     =   5868
   ScaleWidth      =   5760
   StartUpPosition =   2  '螢幕中央
   Begin VB.CommandButton Command6 
      Caption         =   "Read SMS"
      Height          =   372
      Left            =   3500
      TabIndex        =   24
      Top             =   3550
      Width           =   1029
   End
   Begin VB.Frame Frame3 
      Caption         =   "Function and Result"
      Height          =   1692
      Left            =   120
      TabIndex        =   18
      Top             =   4050
      Width           =   5532
      Begin VB.Label Label14 
         BorderStyle     =   1  '單線固定
         Caption         =   "Label14"
         Height          =   288
         Left            =   840
         TabIndex        =   22
         Top             =   1275
         Width           =   4565
      End
      Begin VB.Label Label10 
         AutoSize        =   -1  'True
         Caption         =   "Function"
         Height          =   180
         Left            =   150
         TabIndex        =   21
         Top             =   325
         Width           =   600
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         Caption         =   "Result"
         Height          =   180
         Left            =   330
         TabIndex        =   20
         Top             =   1329
         Width           =   420
      End
      Begin VB.Label Label3 
         BorderStyle     =   1  '單線固定
         Caption         =   "Label3"
         Height          =   852
         Left            =   840
         TabIndex        =   19
         Top             =   325
         Width           =   4565
      End
   End
   Begin VB.CommandButton Command5 
      Caption         =   "More ..."
      Height          =   372
      Left            =   120
      TabIndex        =   17
      Top             =   3550
      Width           =   1029
   End
   Begin VB.Frame Frame2 
      Caption         =   "Caller Initialize/Terminate"
      Height          =   1200
      Left            =   120
      TabIndex        =   7
      Top             =   130
      Width           =   5532
      Begin VB.TextBox Text2 
         Height          =   288
         Left            =   1224
         TabIndex        =   13
         Text            =   "Text2"
         Top             =   720
         Width           =   1788
      End
      Begin VB.TextBox Text1 
         Height          =   288
         Left            =   1224
         TabIndex        =   12
         Text            =   "Text1"
         Top             =   350
         Width           =   1308
      End
      Begin VB.CommandButton Command1 
         Caption         =   "Terminate"
         Height          =   372
         Left            =   4320
         TabIndex        =   9
         Top             =   675
         Width           =   1092
      End
      Begin VB.CommandButton Command2 
         Caption         =   "Initialize"
         Height          =   372
         Left            =   4320
         TabIndex        =   8
         Top             =   240
         Width           =   1092
      End
      Begin VB.Label Label7 
         Caption         =   "Ex. 9600,n,8,1"
         Height          =   180
         Left            =   3150
         TabIndex        =   15
         Top             =   774
         Width           =   1092
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "Ex. 1"
         Height          =   180
         Left            =   2640
         TabIndex        =   14
         Top             =   404
         Width           =   372
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "CommPort"
         Height          =   180
         Left            =   402
         TabIndex        =   11
         Top             =   404
         Width           =   744
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "CommSettings"
         Height          =   180
         Left            =   150
         TabIndex        =   10
         Top             =   774
         Width           =   996
      End
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Exit"
      Height          =   372
      Left            =   4623
      TabIndex        =   6
      Top             =   3550
      Width           =   1029
   End
   Begin VB.Frame Frame1 
      Caption         =   "Send Message"
      Height          =   2075
      Left            =   120
      TabIndex        =   0
      Top             =   1400
      Width           =   5532
      Begin VB.CheckBox Check1 
         Caption         =   "Unicode"
         Height          =   252
         Left            =   1250
         TabIndex        =   23
         Top             =   1755
         Value           =   1  '核取
         Width           =   1092
      End
      Begin VB.CommandButton Command3 
         Caption         =   "Send SMS"
         Height          =   372
         Left            =   4425
         TabIndex        =   5
         Top             =   240
         Width           =   1029
      End
      Begin VB.TextBox Text4 
         Height          =   875
         Left            =   1224
         TabIndex        =   4
         Text            =   "Text4"
         Top             =   850
         Width           =   4175
      End
      Begin VB.TextBox Text3 
         Height          =   288
         Left            =   1224
         TabIndex        =   3
         Text            =   "Text3"
         Top             =   282
         Width           =   3132
      End
      Begin VB.Label Label8 
         Caption         =   "Ex. +886932123123"
         Height          =   180
         Left            =   1300
         TabIndex        =   16
         Top             =   625
         Width           =   2772
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "Short Message"
         Height          =   180
         Left            =   150
         TabIndex        =   2
         Top             =   850
         Width           =   996
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Phone No"
         Height          =   180
         Left            =   474
         TabIndex        =   1
         Top             =   336
         Width           =   672
      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 Command1_Click()
    ' Caller Terminate
    
    myComm.Terminate
    
    Me.Label3 = "myComm.Terminate"
    Me.Label14.Caption = ""
    
End Sub

Private Sub Command2_Click()

    ' Caller Initialize
    Dim String1 As Integer
    Dim String2 As String
    Dim Result As Boolean
    
    Dim String3 As String
    
    String1 = Val(Me.Text1.Text)
    String2 = Me.Text2.Text

    Result = myComm.Initialize(String1, String2)
    String3 = "myComm.Initialize(" & String1 & "," & Chr(34) & String2 & Chr(34) & ")"
    Me.Label3.Caption = String3
    Me.Label14.Caption = Result
    
    If Result Then
        MsgBox "Initialize OK!"
    Else
        MsgBox "Initialize Fail!"
    End If
    
End Sub

Private Sub Command3_Click()

    ' Send Short Message
    Dim String1 As String
    Dim String2 As String
    Dim Result As Boolean
    
    Dim String3 As String
    Dim IsUnicode As Boolean
    
    Dim StringIsUnicode As Boolean
    
    String1 = Me.Text3.Text
    String2 = Me.Text4.Text
    If Me.Check1.Value = 1 Then
        IsUnicode = True
    Else
        IsUnicode = False
    End If
    
    StringIsUnicode = IsUnicodeSMS(String2)
    
    If StringIsUnicode And Not IsUnicode Then
        MsgBox "The short message includes the Unicode!" & vbCrLf & _
               "Please send SMS by Unicode mode."
        Exit Sub
    End If
    
    Result = myComm.SendSMS(String1, String2, IsUnicode)
    
    String3 = "myComm.SendSMS(" & String1 & "," & Chr(34) & String2 & Chr(34) & "," & IsUnicode & ")"
    Me.Label3.Caption = String3
    Me.Label14.Caption = Result
    
End Sub

Private Sub Command4_Click()

    Unload Me
    End
    
End Sub

Private Sub Command5_Click()

    Me.Height = 6175
    
End Sub

Private Sub Command6_Click()

    Dim Result As Boolean
    Dim myDATE As Date
    Dim mySMS As String
    Dim myPHONE As String
    Dim mySTATUS As String
    Dim myString As String
    
    Result = myComm.ReadSMS(myDATE, mySMS, myPHONE, mySTATUS)
    myString = "myComm.ReadSMS(myDATE, mySMS, myPHONE, mySTATUS)"
    
    If Result Then
        myString = myString & vbCrLf & "日期=" & myDATE
        myString = myString & vbCrLf & "簡訊內容=" & mySMS
        myString = myString & vbCrLf & "電話號碼=" & myPHONE
        myString = myString & vbCrLf & "狀態=" & mySTATUS
    End If
    
    Me.Label3.Caption = myString
    Me.Label14.Caption = Result

End Sub

Private Sub Form_Load()

    Me.Text1.Text = 1
    Me.Text2.Text = "9600,n,8,1"
    Me.Text3.Text = ""
    Me.Text4.Text = ""
    Me.Height = 4400
    Me.Label3.Caption = ""
    Me.Label14.Caption = ""

End Sub

Private Sub Form_OLEStartDrag(Data As DataObject, AllowedEffects As Long)

End Sub
