home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Begin VB.Form frmMain
- BorderStyle = 3 'Fixed Dialog
- Caption = "MAPI Mail Sample Program"
- ClientHeight = 7170
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 9270
- Icon = "frmMain.frx":0000
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 7170
- ScaleWidth = 9270
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 'CenterScreen
- Begin MSComctlLib.Toolbar tbMain
- Align = 1 'Align Top
- Height = 660
- Left = 0
- TabIndex = 6
- Top = 0
- Width = 9270
- _ExtentX = 16351
- _ExtentY = 1164
- ButtonWidth = 1032
- ButtonHeight = 1005
- Appearance = 1
- ImageList = "imgMain"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 8
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.ToolTipText = "Send"
- ImageIndex = 1
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.ToolTipText = "Check"
- ImageIndex = 2
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.ToolTipText = "Delete"
- ImageIndex = 3
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.ToolTipText = "Reply"
- ImageIndex = 5
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.ToolTipText = "New"
- ImageIndex = 6
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.ToolTipText = "Foward"
- ImageIndex = 7
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.ToolTipText = "Print"
- ImageIndex = 8
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Object.ToolTipText = "Exit"
- ImageIndex = 4
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.StatusBar sbMain
- Align = 2 'Align Bottom
- Height = 330
- Left = 0
- TabIndex = 5
- Top = 6840
- Width = 9270
- _ExtentX = 16351
- _ExtentY = 582
- _Version = 393216
- BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
- NumPanels = 3
- BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
- AutoSize = 1
- Object.Width = 11165
- EndProperty
- BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
- EndProperty
- BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.ImageList imgMain
- Left = 60
- Top = 6165
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 32
- ImageHeight = 32
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 9
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmMain.frx":0442
- Key = ""
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmMain.frx":0896
- Key = ""
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmMain.frx":0CEA
- Key = ""
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmMain.frx":1006
- Key = ""
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmMain.frx":1322
- Key = ""
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmMain.frx":1776
- Key = ""
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmMain.frx":1A92
- Key = ""
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmMain.frx":1DAE
- Key = ""
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "frmMain.frx":268A
- Key = ""
- EndProperty
- EndProperty
- End
- Begin TabDlg.SSTab sstMain
- Height = 6105
- Left = 15
- TabIndex = 4
- TabStop = 0 'False
- Top = 705
- Width = 9240
- _ExtentX = 16298
- _ExtentY = 10769
- _Version = 393216
- Style = 1
- Tabs = 2
- TabsPerRow = 2
- TabHeight = 520
- TabCaption(0) = "Receive Electronic Mail "
- TabPicture(0) = "frmMain.frx":29A6
- Tab(0).ControlEnabled= -1 'True
- Tab(0).Control(0)= "fraMain"
- Tab(0).Control(0).Enabled= 0 'False
- Tab(0).Control(1)= "fraMessage"
- Tab(0).Control(1).Enabled= 0 'False
- Tab(0).ControlCount= 2
- TabCaption(1) = "Send Electronic Mail "
- TabPicture(1) = "frmMain.frx":29C2
- Tab(1).ControlEnabled= 0 'False
- Tab(1).Control(0)= "lblDestination"
- Tab(1).Control(0).Enabled= 0 'False
- Tab(1).Control(1)= "lblCC"
- Tab(1).Control(1).Enabled= 0 'False
- Tab(1).Control(2)= "lblSubject"
- Tab(1).Control(2).Enabled= 0 'False
- Tab(1).Control(3)= "lblMessage"
- Tab(1).Control(3).Enabled= 0 'False
- Tab(1).Control(4)= "lblAttachments"
- Tab(1).Control(4).Enabled= 0 'False
- Tab(1).Control(5)= "lvAttachments"
- Tab(1).Control(5).Enabled= 0 'False
- Tab(1).Control(6)= "txtDestination"
- Tab(1).Control(6).Enabled= 0 'False
- Tab(1).Control(7)= "txtCC"
- Tab(1).Control(7).Enabled= 0 'False
- Tab(1).Control(8)= "txtSubject"
- Tab(1).Control(8).Enabled= 0 'False
- Tab(1).Control(9)= "txtNewMessage"
- Tab(1).Control(9).Enabled= 0 'False
- Tab(1).Control(10)= "cmdBrowse"
- Tab(1).Control(10).Enabled= 0 'False
- Tab(1).Control(11)= "cdMain"
- Tab(1).Control(11).Enabled= 0 'False
- Tab(1).ControlCount= 12
- Begin MSComDlg.CommonDialog cdMain
- Left = -74895
- Top = 4965
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin VB.CommandButton cmdBrowse
- Caption = "Browse"
- Height = 375
- Left = -73920
- TabIndex = 18
- Top = 5550
- Width = 1380
- End
- Begin VB.TextBox txtNewMessage
- Height = 2925
- Left = -73920
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 3
- Top = 1605
- Width = 8010
- End
- Begin VB.TextBox txtSubject
- Height = 315
- Left = -73920
- TabIndex = 2
- Top = 1230
- Width = 8010
- End
- Begin VB.TextBox txtCC
- Height = 315
- Left = -73920
- TabIndex = 1
- Top = 855
- Width = 8010
- End
- Begin VB.TextBox txtDestination
- Height = 315
- Left = -73920
- TabIndex = 0
- Top = 480
- Width = 8010
- End
- Begin VB.Frame fraMessage
- Caption = "Message Text"
- Height = 3405
- Left = 75
- TabIndex = 8
- Top = 2610
- Width = 9090
- Begin MSComctlLib.ListView lvMain
- Height = 930
- Left = 45
- TabIndex = 11
- TabStop = 0 'False
- Top = 2415
- Width = 8985
- _ExtentX = 15849
- _ExtentY = 1640
- LabelWrap = -1 'True
- HideSelection = -1 'True
- _Version = 393217
- Icons = "imgMain"
- ForeColor = -2147483640
- BackColor = -2147483643
- BorderStyle = 1
- Appearance = 1
- NumItems = 0
- End
- Begin VB.TextBox txtMessage
- Height = 2160
- Left = 60
- Locked = -1 'True
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 9
- TabStop = 0 'False
- Top = 255
- Width = 8955
- End
- End
- Begin VB.Frame fraMain
- Caption = "Available Messages"
- Height = 2175
- Left = 75
- TabIndex = 7
- Top = 390
- Width = 9090
- Begin MSFlexGridLib.MSFlexGrid fgMain
- Height = 1860
- Left = 60
- TabIndex = 10
- TabStop = 0 'False
- Top = 240
- Width = 8955
- _ExtentX = 15796
- _ExtentY = 3281
- _Version = 393216
- Cols = 3
- FixedCols = 0
- BorderStyle = 0
- End
- End
- Begin MSComctlLib.ListView lvAttachments
- Height = 930
- Left = -73935
- TabIndex = 16
- TabStop = 0 'False
- Top = 4590
- Width = 8040
- _ExtentX = 14182
- _ExtentY = 1640
- LabelWrap = -1 'True
- HideSelection = -1 'True
- _Version = 393217
- Icons = "imgMain"
- ForeColor = -2147483640
- BackColor = -2147483643
- BorderStyle = 1
- Appearance = 1
- NumItems = 0
- End
- Begin VB.Label lblAttachments
- AutoSize = -1 'True
- Caption = "Attachments:"
- Height = 195
- Left = -74895
- TabIndex = 17
- Top = 4620
- Width = 930
- End
- Begin VB.Label lblMessage
- AutoSize = -1 'True
- Caption = "Message:"
- Height = 195
- Left = -74895
- TabIndex = 15
- Top = 1605
- Width = 690
- End
- Begin VB.Label lblSubject
- AutoSize = -1 'True
- Caption = "Subject:"
- Height = 195
- Left = -74895
- TabIndex = 14
- Top = 1260
- Width = 585
- End
- Begin VB.Label lblCC
- AutoSize = -1 'True
- Caption = "CC:"
- Height = 195
- Left = -74895
- TabIndex = 13
- Top = 885
- Width = 255
- End
- Begin VB.Label lblDestination
- AutoSize = -1 'True
- Caption = "To:"
- Height = 195
- Left = -74895
- TabIndex = 12
- Top = 510
- Width = 240
- End
- End
- Attribute VB_Name = "frmMain"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub cmdBrowse_Click()
- Dim itmX As Variant
- On Local Error GoTo ReportError
- cdMain.CancelError = True
- cdMain.DialogTitle = "Add Attachment"
- cdMain.Filter = "Any File (*.*)|*.*"
- cdMain.InitDir = App.Path
- cdMain.ShowOpen
- If cdMain.FileName <> "" Then
- Set itmX = lvAttachments.ListItems.Add(, , cdMain.FileTitle, 9)
- itmX.Tag = cdMain.FileName
- End If
- Exit Sub
- ReportError:
- Exit Sub
- End Sub
- Private Sub fgMain_Click()
- Dim tMessages As Variant
- Dim Attachments As Variant
- Dim FileName As String
- Dim itmX As Variant
- Dim y As Integer
- lvMain.ListItems.Clear
- tMessages = oReceive.RcdMessages
- txtMessage.Text = tMessages(3, fgMain.RowSel)
- If Not IsArrayEmpty(tMessages(4, fgMain.RowSel)) Then 'Attachments
- Attachments = tMessages(4, fgMain.RowSel)
- For y = 0 To UBound(Attachments)
- FileName = GetNamePart(CStr(Attachments(y)))
- Set itmX = lvMain.ListItems.Add(, , FileName, 9)
- itmX.Tag = CStr(Attachments(y))
- Next
- End If
- End Sub
- Private Sub Form_Load()
- fgMain.Rows = 1
- fgMain.Row = 0
- fgMain.Col = 0
- fgMain.ColWidth(0) = 3000
- fgMain.Text = "From"
- fgMain.Col = 1
- fgMain.ColWidth(1) = 1900
- fgMain.Text = "Date"
- fgMain.Col = 2
- fgMain.ColWidth(2) = 4000
- fgMain.Text = "Subject"
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- If MsgBox("Are you sure you want to quit?", _
- vbYesNo + vbQuestion, "Quit?") = vbYes Then
- Cancel = False
- Else
- Cancel = True
- End If
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- If Not oMail.LogOff(ErrCode, ErrMsg) Then
- MsgBox "Error: " & ErrCode & " - " & ErrMsg, _
- vbCritical + vbOKOnly, "Log Off Error"
- End If
- Set oReceive = Nothing
- Set oSend = Nothing
- Set oMail = Nothing
- Set frmMain = Nothing
- End Sub
- Private Sub sstMain_Click(PreviousTab As Integer)
- If PreviousTab = 0 Then
- txtDestination.SetFocus
- End If
- End Sub
- Private Sub tbMain_ButtonClick(ByVal Button As MSComctlLib.Button)
- Dim tMessages As Variant
- Dim Attachments As Variant
- Dim FileName As String
- Dim itmX As Variant
- Dim y As Integer
- On Local Error GoTo ReportError
- Select Case Button.Index
- Case 1 'Send
- If lvAttachments.ListItems.Count > 0 Then
- ReDim Attachments(lvAttachments.ListItems.Count) As String
- For y = 1 To lvAttachments.ListItems.Count
- Attachments(y - 1) = lvAttachments.ListItems.Item(y).Tag
- Next
- End If
-
- If Not SendMail(txtDestination.Text, txtCC.Text, txtSubject.Text, _
- txtNewMessage.Text, Attachments, ErrCode, ErrMsg) Then
- GoTo ReportError
- Else
- MsgBox "Email sent...", vbOKOnly + vbInformation, "Sent"
- End If
- Case 2 'Check
- If Not GetMail(fgMain, True, ErrCode, ErrMsg) Then
- GoTo ReportError
- ElseIf oReceive.MessageCount > 0 Then
- lvMain.ListItems.Clear
- tMessages = oReceive.RcdMessages
- txtMessage.Text = tMessages(3, 0)
- If Not IsArrayEmpty(tMessages(4, 0)) Then 'Attachments
- Attachments = tMessages(4, 0)
- For y = 0 To UBound(Attachments)
- FileName = GetNamePart(CStr(Attachments(y)))
- Set itmX = lvMain.ListItems.Add(, , FileName, 9)
- itmX.Tag = CStr(Attachments(y))
- Next
- End If
- End If
- Case 3 'Delete
- Case 4 'Reply
- Case 5 'New
- Case 6 'Foward
- Case 7 'Print
- Case 8 'Exit
- Unload Me
- End Select
- Exit Sub
- ReportError:
- If ErrCode = 0 Then
- ErrCode = Err.Number
- ErrMsg = Err.Description
- End If
- MsgBox "Error: " & ErrCode & " - " & ErrMsg, vbCritical + vbOKOnly, "Error"
- Exit Sub
- End Sub
-