VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form frmCaoSmtpSample 
   BorderStyle     =   1  '固定(実線)
   Caption         =   "CAO SMTP サンプル"
   ClientHeight    =   7800
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   10140
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   7800
   ScaleWidth      =   10140
   StartUpPosition =   3  'Windows の既定値
   Begin VB.CommandButton btnPutValue 
      BackColor       =   &H00FF8080&
      Caption         =   "PUT"
      Height          =   375
      Left            =   9000
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   64
      Top             =   5400
      Width           =   1095
   End
   Begin VB.CommandButton btnGetValue 
      BackColor       =   &H00FF8080&
      Caption         =   "GET"
      Height          =   375
      Left            =   9000
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   63
      Top             =   5040
      Width           =   1095
   End
   Begin VB.TextBox txtReplyTo 
      Height          =   270
      Left            =   1440
      TabIndex        =   15
      Top             =   2880
      Width           =   6975
   End
   Begin VB.CheckBox chkReplyTo 
      Height          =   255
      Left            =   8640
      TabIndex        =   16
      Top             =   2880
      Width           =   255
   End
   Begin VB.CommandButton btnToggle 
      Caption         =   "チェックトグル"
      Height          =   375
      Left            =   4200
      TabIndex        =   42
      Top             =   7320
      Width           =   1335
   End
   Begin VB.CommandButton btnExecute 
      BackColor       =   &H00FF8080&
      Caption         =   "データセット"
      Height          =   375
      Left            =   6000
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   43
      Top             =   7320
      Width           =   1335
   End
   Begin VB.CommandButton btnInputAreaClear 
      Caption         =   "入力欄クリア"
      Height          =   375
      Left            =   2760
      TabIndex        =   41
      Top             =   7320
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FF8080&
      Caption         =   "全クリア"
      Height          =   375
      Left            =   9000
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   40
      Top             =   6960
      Width           =   1095
   End
   Begin VB.CommandButton btnClearAttachment 
      BackColor       =   &H00FF8080&
      Caption         =   "クリア"
      Height          =   375
      Left            =   9000
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   37
      Top             =   6480
      Width           =   1095
   End
   Begin VB.CommandButton btnClearMessage 
      BackColor       =   &H00FF8080&
      Caption         =   "クリア"
      Height          =   375
      Left            =   9000
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   30
      Top             =   4680
      Width           =   1095
   End
   Begin VB.CommandButton btnClearBCC 
      BackColor       =   &H00FF8080&
      Caption         =   "クリア"
      Height          =   375
      Left            =   9000
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   25
      Top             =   3840
      Width           =   1095
   End
   Begin VB.CommandButton btnClearCC 
      BackColor       =   &H00FF8080&
      Caption         =   "クリア"
      Height          =   375
      Left            =   9000
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   22
      Top             =   3480
      Width           =   1095
   End
   Begin VB.CommandButton btnClearTO 
      BackColor       =   &H00FF8080&
      Caption         =   "クリア"
      Height          =   375
      Left            =   9000
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   19
      Top             =   3120
      Width           =   1095
   End
   Begin VB.CheckBox chkPriority 
      Height          =   255
      Left            =   3120
      TabIndex        =   39
      Top             =   6840
      Width           =   255
   End
   Begin VB.CheckBox chkAttach 
      Height          =   255
      Left            =   8640
      TabIndex        =   36
      Top             =   6480
      Width           =   255
   End
   Begin VB.CheckBox chkSendFileName 
      Height          =   255
      Left            =   8640
      TabIndex        =   32
      Top             =   6120
      Width           =   255
   End
   Begin VB.TextBox txtSendFileName 
      Height          =   270
      Left            =   1440
      TabIndex        =   31
      Top             =   6120
      Width           =   6975
   End
   Begin VB.CheckBox chkBin 
      Caption         =   "データとしてセット"
      Height          =   375
      Left            =   6480
      TabIndex        =   35
      Top             =   6480
      Width           =   1815
   End
   Begin VB.CheckBox chkMessage 
      Height          =   255
      Left            =   8640
      TabIndex        =   29
      Top             =   4680
      Width           =   255
   End
   Begin VB.CheckBox chkTitle 
      Height          =   255
      Left            =   8640
      TabIndex        =   27
      Top             =   4320
      Width           =   255
   End
   Begin VB.CheckBox chkBCC 
      Height          =   255
      Left            =   8640
      TabIndex        =   24
      Top             =   3960
      Width           =   255
   End
   Begin VB.CheckBox chkCC 
      Height          =   255
      Left            =   8640
      TabIndex        =   21
      Top             =   3600
      Width           =   255
   End
   Begin VB.CheckBox chkTO 
      Height          =   255
      Left            =   8640
      TabIndex        =   18
      Top             =   3240
      Width           =   255
   End
   Begin VB.CheckBox chkSenderName 
      Height          =   255
      Left            =   8640
      TabIndex        =   14
      Top             =   2520
      Width           =   255
   End
   Begin VB.CheckBox chkSenderMail 
      Height          =   255
      Left            =   8640
      TabIndex        =   12
      Top             =   2160
      Width           =   255
   End
   Begin VB.CheckBox chkPassword 
      Height          =   255
      Left            =   8640
      TabIndex        =   10
      Top             =   1800
      Width           =   255
   End
   Begin VB.CheckBox chkLogin 
      Height          =   255
      Left            =   8640
      TabIndex        =   8
      Top             =   1440
      Width           =   255
   End
   Begin VB.CommandButton btnDelFile 
      BackColor       =   &H00FF8080&
      Caption         =   "DelFile"
      Height          =   375
      Left            =   7680
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   6
      Top             =   960
      Width           =   1095
   End
   Begin VB.CommandButton btnAddFile 
      BackColor       =   &H00FF8080&
      Caption         =   "AddFile"
      Height          =   375
      Left            =   6360
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   5
      Top             =   960
      Width           =   1095
   End
   Begin VB.ComboBox cmbCharSet 
      Height          =   300
      ItemData        =   "frmCaoSmtpSample.frx":0000
      Left            =   6000
      List            =   "frmCaoSmtpSample.frx":000A
      Style           =   2  'ﾄﾞﾛｯﾌﾟﾀﾞｳﾝ ﾘｽﾄ
      TabIndex        =   4
      Top             =   600
      Width           =   2415
   End
   Begin MSComDlg.CommonDialog dlgOpenFile 
      Left            =   9600
      Top             =   0
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton btnFile 
      Caption         =   "参照"
      Height          =   375
      Left            =   5520
      TabIndex        =   34
      Top             =   6480
      Width           =   855
   End
   Begin VB.ComboBox cmbPriority 
      Height          =   300
      ItemData        =   "frmCaoSmtpSample.frx":0025
      Left            =   1440
      List            =   "frmCaoSmtpSample.frx":0032
      Style           =   2  'ﾄﾞﾛｯﾌﾟﾀﾞｳﾝ ﾘｽﾄ
      TabIndex        =   38
      Top             =   6840
      Width           =   1575
   End
   Begin VB.ComboBox cmbSecurity 
      Height          =   300
      ItemData        =   "frmCaoSmtpSample.frx":0049
      Left            =   3960
      List            =   "frmCaoSmtpSample.frx":0056
      Style           =   2  'ﾄﾞﾛｯﾌﾟﾀﾞｳﾝ ﾘｽﾄ
      TabIndex        =   3
      Top             =   600
      Width           =   1095
   End
   Begin VB.ComboBox cmbAuth 
      Height          =   300
      ItemData        =   "frmCaoSmtpSample.frx":006A
      Left            =   1440
      List            =   "frmCaoSmtpSample.frx":0074
      Style           =   2  'ﾄﾞﾛｯﾌﾟﾀﾞｳﾝ ﾘｽﾄ
      TabIndex        =   2
      Top             =   600
      Width           =   1095
   End
   Begin VB.CommandButton btnSend 
      BackColor       =   &H00FF8080&
      Caption         =   "送信"
      Height          =   375
      Left            =   7440
      Style           =   1  'ｸﾞﾗﾌｨｯｸｽ
      TabIndex        =   44
      Top             =   7320
      Width           =   1095
   End
   Begin VB.TextBox txtAttachment 
      Height          =   270
      Left            =   1440
      TabIndex        =   33
      Top             =   6480
      Width           =   3975
   End
   Begin VB.TextBox txtMessage 
      Height          =   1335
      Left            =   1440
      MultiLine       =   -1  'True
      ScrollBars      =   2  '垂直
      TabIndex        =   28
      Top             =   4680
      Width           =   6975
   End
   Begin VB.TextBox txtTitle 
      Height          =   270
      Left            =   1440
      TabIndex        =   26
      Top             =   4320
      Width           =   6975
   End
   Begin VB.TextBox txtBCC 
      Height          =   270
      Left            =   1440
      TabIndex        =   23
      Top             =   3960
      Width           =   6975
   End
   Begin VB.TextBox txtCC 
      Height          =   270
      Left            =   1440
      TabIndex        =   20
      Top             =   3600
      Width           =   6975
   End
   Begin VB.TextBox txtTO 
      Height          =   270
      Left            =   1440
      TabIndex        =   17
      Top             =   3240
      Width           =   6975
   End
   Begin VB.TextBox txtSenderName 
      Height          =   270
      Left            =   1440
      TabIndex        =   13
      Top             =   2520
      Width           =   6975
   End
   Begin VB.TextBox txtSenderMail 
      Height          =   270
      Left            =   1440
      TabIndex        =   11
      Top             =   2160
      Width           =   6975
   End
   Begin VB.TextBox txtPassword 
      Height          =   270
      IMEMode         =   3  'ｵﾌ固定
      Left            =   1440
      PasswordChar    =   "*"
      TabIndex        =   9
      Top             =   1800
      Width           =   6975
   End
   Begin VB.TextBox txtLogin 
      Height          =   270
      IMEMode         =   3  'ｵﾌ固定
      Left            =   1440
      TabIndex        =   7
      Top             =   1440
      Width           =   6975
   End
   Begin VB.TextBox txtPort 
      Height          =   270
      Left            =   7800
      MaxLength       =   5
      TabIndex        =   1
      Top             =   240
      Width           =   1095
   End
   Begin VB.TextBox txtServer 
      Height          =   270
      Left            =   1440
      TabIndex        =   0
      Top             =   240
      Width           =   5295
   End
   Begin VB.Label Label19 
      Caption         =   "(青ボタン：コマンド送信、*印：Addされる項目)"
      Height          =   255
      Left            =   3600
      TabIndex        =   62
      Top             =   6960
      Width           =   3615
   End
   Begin VB.Label Label18 
      Caption         =   "返信先"
      Height          =   255
      Left            =   240
      TabIndex        =   61
      Top             =   2880
      Width           =   1095
   End
   Begin VB.Label Label17 
      Caption         =   "ファイル名"
      Height          =   255
      Left            =   240
      TabIndex        =   60
      Top             =   6120
      Width           =   1095
   End
   Begin VB.Label Label15 
      Caption         =   "重要度"
      Height          =   255
      Left            =   240
      TabIndex        =   59
      Top             =   6840
      Width           =   1095
   End
   Begin VB.Label Label14 
      Caption         =   "添付*"
      Height          =   255
      Left            =   240
      TabIndex        =   58
      Top             =   6480
      Width           =   1095
   End
   Begin VB.Label Label13 
      Caption         =   "本文*"
      Height          =   255
      Left            =   240
      TabIndex        =   57
      Top             =   4680
      Width           =   1095
   End
   Begin VB.Label Label12 
      Caption         =   "タイトル"
      Height          =   255
      Left            =   240
      TabIndex        =   56
      Top             =   4320
      Width           =   1095
   End
   Begin VB.Label Label11 
      Caption         =   "BCC*"
      Height          =   255
      Left            =   240
      TabIndex        =   55
      Top             =   3960
      Width           =   1095
   End
   Begin VB.Label Label10 
      Caption         =   "CC*"
      Height          =   255
      Left            =   240
      TabIndex        =   54
      Top             =   3600
      Width           =   1095
   End
   Begin VB.Label Label9 
      Caption         =   "TO*"
      Height          =   255
      Left            =   240
      TabIndex        =   53
      Top             =   3240
      Width           =   1095
   End
   Begin VB.Label Label8 
      Caption         =   "送信者名"
      Height          =   255
      Left            =   240
      TabIndex        =   52
      Top             =   2520
      Width           =   1095
   End
   Begin VB.Label Label7 
      Caption         =   "送信者メール"
      Height          =   255
      Left            =   240
      TabIndex        =   51
      Top             =   2160
      Width           =   1095
   End
   Begin VB.Label Label6 
      Caption         =   "パスワード"
      Height          =   255
      Left            =   240
      TabIndex        =   50
      Top             =   1800
      Width           =   1095
   End
   Begin VB.Label Label5 
      Caption         =   "ログイン"
      Height          =   255
      Left            =   240
      TabIndex        =   49
      Top             =   1440
      Width           =   1095
   End
   Begin VB.Label Label4 
      Caption         =   "セキュリティ"
      Height          =   255
      Left            =   2760
      TabIndex        =   48
      Top             =   600
      Width           =   1095
   End
   Begin VB.Label Label3 
      Caption         =   "認証"
      Height          =   255
      Left            =   120
      TabIndex        =   47
      Top             =   600
      Width           =   1095
   End
   Begin VB.Label Label2 
      Caption         =   "ポート"
      Height          =   255
      Left            =   7080
      TabIndex        =   46
      Top             =   240
      Width           =   615
   End
   Begin VB.Label Label1 
      Caption         =   "サーバー"
      Height          =   255
      Left            =   120
      TabIndex        =   45
      Top             =   240
      Width           =   1095
   End
End
Attribute VB_Name = "frmCaoSmtpSample"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private m_caoEng As CaoEngine
Private m_caoWs As CaoWorkspace
Private m_caoCtrl As CaoController
Private m_cFile As CaoFile

' AddFileボタン押下時の処理
Private Sub btnAddFile_Click()
    On Error GoTo ERR1
    Call DeleteFile
    Set m_cFile = m_caoCtrl.AddFile("mail1", "Server=" & txtServer.Text & "," & "Port=" & txtPort.Text & "," & "Auth=" & cmbAuth.Text & "," & "Security=" & cmbSecurity.Text & ",CharSet=" & cmbCharSet)
    If Not m_cFile Is Nothing Then
        MsgBox "作成しました"
        Exit Sub
    Else
        MsgBox "作成に失敗しました"
        Exit Sub
    End If
ERR1:
    MsgBox Err.Description, vbExclamation
    On Error GoTo 0
End Sub

' ファイル削除処理
Private Sub DeleteFile()
    If m_caoCtrl.Files.Count > 0 Then
        Call m_caoCtrl.Files.Remove(0)
    End If
End Sub

' 添付ファイルのクリアボタン押下時の処理
Private Sub btnClearAttachment_Click()
    Dim ret As Boolean
    If m_cFile Is Nothing Or m_caoCtrl.Files.Count = 0 Then
        MsgBox "先にAddFileボタンを押してください。"
        Exit Sub
    End If
    ret = SendExecute("DelAttachments", Nothing)
    If ret = True Then
        MsgBox "成功しました"
    Else
        MsgBox "失敗しました"
    End If
End Sub

' BCCのクリアボタン押下時の処理
Private Sub btnClearBCC_Click()
    Dim ret As Boolean
    If m_cFile Is Nothing Or m_caoCtrl.Files.Count = 0 Then
        MsgBox "先にAddFileボタンを押してください。"
        Exit Sub
    End If
    ret = SendExecute("DelBCCRecipients", Nothing)
    If ret = True Then
        MsgBox "成功しました"
    Else
        MsgBox "失敗しました"
    End If
End Sub

' CCのクリアボタン押下時の処理
Private Sub btnClearCC_Click()
    Dim ret As Boolean
    If m_cFile Is Nothing Or m_caoCtrl.Files.Count = 0 Then
        MsgBox "先にAddFileボタンを押してください。"
        Exit Sub
    End If
    ret = SendExecute("DelCCRecipients", Nothing)
    If ret = True Then
        MsgBox "成功しました"
    Else
        MsgBox "失敗しました"
    End If
End Sub

' 本文のクリアボタン押下時の処理
Private Sub btnClearMessage_Click()
    Dim ret As Boolean
    If m_cFile Is Nothing Or m_caoCtrl.Files.Count = 0 Then
        MsgBox "先にAddFileボタンを押してください。"
        Exit Sub
    End If
    ret = SendExecute("DelMsgLines", Nothing)
    If ret = True Then
        MsgBox "成功しました"
    Else
        MsgBox "失敗しました"
    End If
End Sub

' TOのクリアボタン押下時の処理
Private Sub btnClearTO_Click()
    Dim ret As Boolean
    If m_cFile Is Nothing Or m_caoCtrl.Files.Count = 0 Then
        MsgBox "先にAddFileボタンを押してください。"
        Exit Sub
    End If
    ret = SendExecute("DelRecipients", Nothing)
    If ret = True Then
        MsgBox "成功しました"
    Else
        MsgBox "失敗しました"
    End If
End Sub

' DelFileボタン押下時の処理
Private Sub btnDelFile_Click()
    Call DeleteFile
    MsgBox "削除しました"
End Sub

' データセットボタン押下時の処理
Private Sub btnExecute_Click()
    On Error GoTo ERR1:
    If m_cFile Is Nothing Or m_caoCtrl.Files.Count = 0 Then
        MsgBox "先にAddFileボタンを押してください。"
        Exit Sub
    End If
    Dim binBuffer() As Byte
    Dim lBufferSize As Long
    Dim lFile As Long
    If chkLogin.Value = 1 Then
        Call m_cFile.Execute("SetLogin", txtLogin.Text)
    End If
    If chkPassword.Value = 1 Then
        Call m_cFile.Execute("SetPassword", txtPassword.Text)
    End If
    If chkSenderMail.Value = 1 Then
        Call m_cFile.Execute("SetSenderMail", txtSenderMail.Text)
    End If
    If chkSenderName.Value = 1 Then
        Call m_cFile.Execute("SetSenderName", txtSenderName.Text)
    End If
    If chkReplyTo.Value = 1 Then
        Call m_cFile.Execute("SetReplyTo", txtReplyTo.Text)
    End If
    If chkTO.Value = 1 Then
        Call m_cFile.Execute("AddRecipient", txtTO.Text)
    End If
    If chkCC.Value = 1 Then
        Call m_cFile.Execute("AddCCRecipient", txtCC.Text)
    End If
    If chkBCC.Value = 1 Then
        Call m_cFile.Execute("AddBCCRecipient", txtBCC.Text)
    End If
    If chkTitle.Value = 1 Then
        Call m_cFile.Execute("SetSubject", txtTitle.Text)
    End If
    If chkMessage.Value = 1 Then
        Call m_cFile.Execute("AddMsgLine", txtMessage.Text)
    End If
    If chkSendFileName.Value = 1 Then
        Call m_cFile.Execute("SetAttachFileName", txtSendFileName.Text)
    End If
    If chkAttach.Value = 1 Then
        If chkBin.Value = 1 Then
            lFile = FreeFile
            lBufferSize = GetFileSize(txtAttachment.Text)
            Open txtAttachment.Text For Binary Access Read As #lFile
                ReDim binBuffer(lBufferSize - 1)
                Get #lFile, , binBuffer
            Close #lFile
            Call m_cFile.Execute("AddAttachment", binBuffer)
        Else
            Call m_cFile.Execute("AddAttachment", txtAttachment.Text)
        End If
    End If
    If chkPriority.Value = 1 Then
        Call m_cFile.Execute("SetXPriority", cmbPriority.Text)
    End If
    MsgBox "正常終了しました"
    On Error GoTo 0
    Exit Sub
ERR1:
    MsgBox Err.Description
    On Error GoTo 0
End Sub

' ファイルサイズを取得する処理
Private Function GetFileSize(strFileName As String) As Long
    Dim cFso As FileSystemObject
    Set cFso = New FileSystemObject

    Dim cFile As File
    Set cFile = cFso.GetFile(strFileName)

    Set cFso = Nothing

    GetFileSize = cFile.Size

    Set cFile = Nothing
End Function

' 添付ファイルの参照ボタン押下時の処理
Private Sub btnFile_Click()
    dlgOpenFile.ShowOpen
    txtAttachment.Text = dlgOpenFile.FileName
End Sub

Private Sub btnGetValue_Click()
    On Error GoTo ERR1:
    If m_cFile Is Nothing Or m_caoCtrl.Files.Count = 0 Then
        MsgBox "先にAddFileボタンを押してください。"
        Exit Sub
    End If
    txtMessage.Text = m_cFile.Value
    MsgBox "成功しました"
    On Error GoTo 0
    Exit Sub
ERR1:
    MsgBox Err.Description
    On Error GoTo 0
End Sub

' 入力欄クリアボタン押下時の処理
Private Sub btnInputAreaClear_Click()
    Call ClearAllInputArea
End Sub

' 入力欄クリア処理
Private Sub ClearAllInputArea()
    txtServer.Text = ""
    txtPort.Text = ""
    txtLogin.Text = ""
    txtPassword.Text = ""
    txtSenderMail.Text = ""
    txtSenderName.Text = ""
    txtReplyTo.Text = ""
    txtTO.Text = ""
    txtCC.Text = ""
    txtBCC.Text = ""
    txtTitle.Text = ""
    txtMessage.Text = ""
    txtSendFileName.Text = ""
    txtAttachment.Text = ""
End Sub

Private Sub btnPutValue_Click()
    On Error GoTo ERR1:
    If m_cFile Is Nothing Or m_caoCtrl.Files.Count = 0 Then
        MsgBox "先にAddFileボタンを押してください。"
        Exit Sub
    End If
    m_cFile.Value = txtMessage.Text
    MsgBox "成功しました"
    On Error GoTo 0
    Exit Sub
ERR1:
    MsgBox Err.Description
    On Error GoTo 0
End Sub

' 送信ボタン押下時の処理
Private Sub btnSend_Click()
    Dim ret As Boolean
    If m_cFile Is Nothing Or m_caoCtrl.Files.Count = 0 Then
        MsgBox "先にAddFileボタンを押してください。"
        Exit Sub
    End If
    ret = SendExecute("Send", Nothing)
    If ret = True Then
        MsgBox "成功しました"
    Else
        MsgBox "失敗しました"
    End If
End Sub

' チェックトグルボタン押下時の処理
Private Sub btnToggle_Click()
    Dim chk As Integer
    If chkLogin.Value = 1 Then
        chk = 0
    Else
        chk = 1
    End If
    Call SetAllCheck(chk)
End Sub

' 全チェックボックス切り替え処理
Private Sub SetAllCheck(chk As Integer)
    chkLogin.Value = chk
    chkPassword.Value = chk
    chkSenderMail.Value = chk
    chkSenderName.Value = chk
    chkReplyTo.Value = chk
    chkTO.Value = chk
    chkCC.Value = chk
    chkBCC.Value = chk
    chkTitle.Value = chk
    chkMessage.Value = chk
    chkSendFileName.Value = chk
    chkAttach.Value = chk
    chkPriority.Value = chk
End Sub

' 全クリアボタン押下時の処理
Private Sub Command1_Click()
    Dim ret As Boolean
    If m_cFile Is Nothing Or m_caoCtrl.Files.Count = 0 Then
        MsgBox "先にAddFileボタンを押してください。"
        Exit Sub
    End If
    ret = SendExecute("ClearMessage", Nothing)
    If ret = True Then
        MsgBox "成功しました"
    Else
        MsgBox "失敗しました"
    End If
End Sub

' フォームロード時の処理
Private Sub Form_Load()
    
    Set m_caoEng = New CaoEngine
    Set m_caoWs = m_caoEng.Workspaces(0)
    Set m_caoCtrl = m_caoWs.AddController("TestCtrl", "CaoProv.SMTP")
    cmbAuth.Text = "NO"
    cmbSecurity.Text = "NONE"
    cmbPriority.Text = "NORMAL"
    cmbCharSet.Text = "US-ASCII"
End Sub

' コマンド送信処理
Private Function SendExecute(strCommand As String, data As Variant) As Boolean
    On Error GoTo ERR1
    
    Call m_cFile.Execute(strCommand, data)
    
    SendExecute = True
    Exit Function
ERR1:
    MsgBox Err.Description
    SendExecute = False
End Function

