VERSION 5.00
Begin VB.Form 控三乙Enable 
   Caption         =   "控三乙Enable"
   ClientHeight    =   5700
   ClientLeft      =   48
   ClientTop       =   432
   ClientWidth     =   3360
   LinkTopic       =   "Form1"
   ScaleHeight     =   5700
   ScaleWidth      =   3360
   StartUpPosition =   3  '系統預設值
   Begin VB.CommandButton Command12 
      Caption         =   "切斷"
      Height          =   732
      Left            =   2400
      TabIndex        =   15
      Top             =   1200
      Width           =   732
   End
   Begin VB.CommandButton Command11 
      Caption         =   "連接"
      Height          =   732
      Left            =   2400
      TabIndex        =   14
      Top             =   240
      Width           =   732
   End
   Begin VB.TextBox Text1 
      Height          =   264
      Left            =   360
      TabIndex        =   13
      Text            =   "沒連上啦∼"
      Top             =   1680
      Width           =   1812
   End
   Begin VB.ComboBox Combo1 
      Height          =   276
      ItemData        =   "控三乙Enable.frx":0000
      Left            =   360
      List            =   "控三乙Enable.frx":001F
      TabIndex        =   10
      Text            =   "4"
      Top             =   720
      Width           =   1812
   End
   Begin VB.CommandButton Command10 
      Caption         =   "家電e關"
      Height          =   612
      Left            =   1920
      TabIndex        =   9
      Top             =   5040
      Width           =   1212
   End
   Begin VB.CommandButton Command9 
      Caption         =   "家電e開"
      Height          =   612
      Left            =   240
      TabIndex        =   8
      Top             =   5040
      Width           =   1212
   End
   Begin VB.CommandButton Command8 
      Caption         =   "家電d關"
      Height          =   612
      Left            =   1920
      TabIndex        =   7
      Top             =   4320
      Width           =   1212
   End
   Begin VB.CommandButton Command7 
      Caption         =   "家電d開"
      Height          =   612
      Left            =   240
      TabIndex        =   6
      Top             =   4320
      Width           =   1212
   End
   Begin VB.CommandButton Command6 
      Caption         =   "家電c關"
      Height          =   612
      Left            =   1920
      TabIndex        =   5
      Top             =   3600
      Width           =   1212
   End
   Begin VB.CommandButton Command5 
      Caption         =   "家電c開"
      Height          =   612
      Left            =   240
      TabIndex        =   4
      Top             =   3600
      Width           =   1212
   End
   Begin VB.CommandButton Command4 
      Caption         =   "家電b關"
      Height          =   612
      Left            =   1920
      TabIndex        =   3
      Top             =   2880
      Width           =   1212
   End
   Begin VB.CommandButton Command3 
      Caption         =   "家電b開"
      Height          =   612
      Left            =   240
      TabIndex        =   2
      Top             =   2880
      Width           =   1212
   End
   Begin VB.CommandButton Command2 
      Caption         =   "家電a關"
      Height          =   612
      Left            =   1920
      TabIndex        =   1
      Top             =   2160
      Width           =   1212
   End
   Begin VB.CommandButton Command1 
      Caption         =   "家電a開"
      Height          =   660
      Left            =   240
      TabIndex        =   0
      Top             =   2160
      Width           =   1212
   End
   Begin VB.Label Label2 
      Caption         =   "com狀態:"
      Height          =   372
      Left            =   360
      TabIndex        =   12
      Top             =   1320
      Width           =   1212
   End
   Begin VB.Label Label1 
      Caption         =   "選擇裝置Com:"
      Height          =   252
      Left            =   360
      TabIndex        =   11
      Top             =   360
      Width           =   1692
   End
End
Attribute VB_Name = "控三乙Enable"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Sub Command1_Click()
Dim Buffer01 As Variant
Dim ByteArray01(0) As Byte
If MSComm1.PortOpen = True Then
    ByteArray01(0) = 1 'assign 1 as forward command
    Buffer01 = ByteArray01
    MSComm1.Output = Buffer01 'transmit command
Else
    Text1.Text = "請先連接通訊埠"
End If
End Sub

Private Sub Command10_Click()
    Dim Buffer01 As Variant
    Dim ByteArray01(0) As Byte
    If MSComm1.PortOpen = True Then
        ByteArray01(0) = 10 'assign 10 as forward command
        Buffer01 = ByteArray01
        MSComm1.Output = Buffer01 'transmit command
    Else
        Text1.Text = "請先連接通訊埠"
        End If
End Sub

Private Sub Command11_Click()
    If MSComm1.PortOpen = True Then   ' turn off opened com port
        MSComm1.PortOpen = False
    End If
        MSComm1.Settings = "9600,N,8,1" 'COM Port Setting
        MSComm1.CommPort = Combo1.Text 'Set Port Number
        MSComm1.PortOpen = True 'Open com port
        Text1.Text = "通訊埠已開啟"
End Sub

Private Sub Command12_Click()
    EndMSComm1.PortOpen = False 'turn off com port
    Text1.Text = "通訊埠已切斷"
End Sub

Private Sub Command2_Click()
Dim Buffer01 As Variant
Dim ByteArray01(0) As Byte
If MSComm1.PortOpen = True Then
    ByteArray01(0) = 2 'assign 2 as forward command
    Buffer01 = ByteArray01
    MSComm1.Output = Buffer01 'transmit command
Else
    Text1.Text = "請先連接通訊埠"
End If
End Sub

Private Sub Command3_Click()
Dim Buffer01 As Variant
Dim ByteArray01(0) As Byte
If MSComm1.PortOpen = True Then
    ByteArray01(0) = 3 'assign 3 as forward command
    Buffer01 = ByteArray01
    MSComm1.Output = Buffer01 'transmit command
Else
    Text1.Text = "請先連接通訊埠"
End If
End Sub

Private Sub Command4_Click()
Dim Buffer01 As Variant
Dim ByteArray01(0) As Byte
    If MSComm1.PortOpen = True Then
    ByteArray01(0) = 4 'assign 4 as forward command
    Buffer01 = ByteArray01
    MSComm1.Output = Buffer01 'transmit command
Else
    Text1.Text = "請先連接通訊埠"
End If
End Sub

Private Sub Command5_Click()
Dim Buffer01 As Variant
Dim ByteArray01(0) As Byte
If MSComm1.PortOpen = True Then
    ByteArray01(0) = 5 'assign 5 as forward command
    Buffer01 = ByteArray01
    MSComm1.Output = Buffer01 'transmit command
Else
    Text1.Text = "請先連接通訊埠"
End If
End Sub

Private Sub Command6_Click()
Dim Buffer01 As Variant
Dim ByteArray01(0) As Byte
If MSComm1.PortOpen = True Then
    ByteArray01(0) = 6 'assign 6 as forward command
    Buffer01 = ByteArray01
    MSComm1.Output = Buffer01 'transmit command
Else
    Text1.Text = "請先連接通訊埠"
End If
End Sub

Private Sub Command7_Click()
Dim Buffer01 As Variant
Dim ByteArray01(0) As Byte
If MSComm1.PortOpen = True Then
    ByteArray01(0) = 7 'assign 7 as forward command
    Buffer01 = ByteArray01
    MSComm1.Output = Buffer01 'transmit command
Else
    Text1.Text = "請先連接通訊埠"
End If
End Sub

Private Sub Command8_Click()
Dim Buffer01 As Variant
Dim ByteArray01(0) As Byte
If MSComm1.PortOpen = True Then
    ByteArray01(0) = 8 'assign 8 as forward command
    Buffer01 = ByteArray01
    MSComm1.Output = Buffer01 'transmit command
Else
    Text1.Text = "請先連接通訊埠"
End If
End Sub

Private Sub Command9_Click()
Dim Buffer01 As Variant
Dim ByteArray01(0) As Byte
If MSComm1.PortOpen = True Then
    ByteArray01(0) = 9 'assign 9 as forward command
    Buffer01 = ByteArray01
    MSComm1.Output = Buffer01 'transmit command
Else
    Text1.Text = "請先連接通訊埠"
End If
End Sub

