Attribute VB_Name = "Mail"
Option Explicit

'----------------------------------------------------------
'  Function     : GetSendAddress
'  Return value :
'  Argument     :
'  Feature      :
'  Description  :
'  Remarks      :
'----------------------------------------------------------
Function GetSendAddress() As String

    Dim szSendAddress As String
    Dim i As Integer
    Dim tmp As String
    Dim szTo As String, szCc As String, szBcc As String

    szTo = "":  szCc = "":  szBcc = ""
    For i = 1 To 10
        If (MailInfo.SendAddress(i) <> "") Then
            tmp = CutParam(";", MailInfo.SendAddress(i), 2)
            Select Case tmp
                Case "TO"
                    If (szTo = "") Then
                        szTo = CutParam(";", MailInfo.SendAddress(i), 1)
                    Else
                        szTo = szTo & vbTab & CutParam(";", MailInfo.SendAddress(i), 1)
                    End If
                Case "CC"
                    If (szCc = "") Then
                        szCc = CutParam(";", MailInfo.SendAddress(i), 1)
                    Else
                        szCc = szCc & vbTab & CutParam(";", MailInfo.SendAddress(i), 1)
                    End If
                Case "BCC"
                    If (szBcc = "") Then
                        szBcc = CutParam(";", MailInfo.SendAddress(i), 1)
                    Else
                        szBcc = szBcc & vbTab & CutParam(";", MailInfo.SendAddress(i), 1)
                    End If
            End Select
        End If
    Next i
    
    szSendAddress = szTo
    If (szCc <> "") Then
        szSendAddress = szSendAddress & vbTab & "cc" & vbTab & szCc
    End If
    If (szBcc <> "") Then
        szSendAddress = szSendAddress & vbTab & "bcc" & vbTab & szBcc
    End If
    
    GetSendAddress = szSendAddress

End Function

'----------------------------------------------------------
'  Function     : MailAddrButtonUpdate
'  Return value :
'  Argument     :
'  Feature      :
'  Description  :
'  Remarks      :
'----------------------------------------------------------
Sub MailAddrButtonUpdate()

    If (MailForm.MailAddrList.ListItems.Count = 0) Then
        MailForm.cmdDelete.Enabled = False
        MailForm.cmdEdit.Enabled = False
    Else
        If (MailForm.MailAddrList.SelectedItem.Selected = False) Then
            MailForm.cmdDelete.Enabled = False
            MailForm.cmdEdit.Enabled = False
        Else
            MailForm.cmdDelete.Enabled = True
            MailForm.cmdEdit.Enabled = True
        End If
    End If

End Sub


