home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Main
- Caption = "Simple Mail Tool"
- ClientHeight = 4035
- ClientLeft = 1245
- ClientTop = 1545
- ClientWidth = 6435
- Height = 4440
- Left = 1185
- LinkTopic = "Form1"
- ScaleHeight = 4035
- ScaleWidth = 6435
- Top = 1200
- Width = 6555
- Begin VB.CommandButton Command1
- Caption = "E&xit"
- Height = 300
- Index = 8
- Left = 5100
- TabIndex = 10
- Top = 3600
- Width = 1215
- End
- Begin VB.CommandButton Command1
- Caption = "Address &Book"
- Height = 300
- Index = 7
- Left = 5100
- TabIndex = 9
- Top = 3060
- Width = 1215
- End
- Begin VB.CommandButton Command1
- Caption = "&Read"
- Height = 300
- Index = 6
- Left = 5100
- TabIndex = 8
- Top = 2640
- Width = 1215
- End
- Begin VB.CommandButton Command1
- Caption = "&Delete"
- Height = 300
- Index = 5
- Left = 5100
- TabIndex = 7
- Top = 2220
- Width = 1200
- End
- Begin VB.CommandButton Command1
- Caption = "&Reply &All"
- Height = 300
- Index = 4
- Left = 5100
- TabIndex = 6
- Top = 1800
- Width = 1200
- End
- Begin VB.CommandButton Command1
- Caption = "R&eply"
- Height = 300
- Index = 3
- Left = 5100
- TabIndex = 5
- Top = 1380
- Width = 1200
- End
- Begin VB.CommandButton Command1
- Caption = "&Forward"
- Height = 300
- Index = 2
- Left = 5100
- TabIndex = 4
- Top = 960
- Width = 1200
- End
- Begin VB.CommandButton Command1
- Caption = "&Copy"
- Height = 300
- Index = 1
- Left = 5100
- TabIndex = 3
- Top = 540
- Width = 1200
- End
- Begin VB.CommandButton Command1
- Caption = "&New"
- Height = 300
- Index = 0
- Left = 5100
- TabIndex = 2
- Top = 120
- Width = 1200
- End
- Begin VB.ListBox List1
- Height = 2790
- Left = 120
- TabIndex = 0
- Top = 480
- Width = 4815
- End
- Begin MSMAPI.MAPIMessages MAPIMessages1
- Left = 1140
- Top = 3420
- _Version = 65536
- _ExtentX = 741
- _ExtentY = 741
- _StockProps = 0
- End
- Begin MSMAPI.MAPISession MAPISession1
- Left = 540
- Top = 3360
- _Version = 65536
- _ExtentX = 741
- _ExtentY = 741
- _StockProps = 0
- End
- Begin VB.Label Label1
- BorderStyle = 1 'Fixed Single
- Caption = "Messages:"
- Height = 255
- Left = 120
- TabIndex = 1
- Top = 120
- Width = 4815
- End
- Attribute VB_Name = "Main"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub Command1_Click(Index As Integer)
- '
- ' handle user clicks
- '
- On Error GoTo Command1ClickErr
- '
- Dim nTemp As Integer
- '
- Select Case Index
- Case 0
- ' new message
- MAPIMessages1.Compose ' clear compose buffer
- MAPIMessages1.Send True ' start server dialog
- Case 1
- ' copy message
- MAPIMessages1.MsgIndex = List1.ListIndex ' point to msg
- MAPIMessages1.Copy ' copy in to compose buffer
- MAPIMessages1.Send True ' start server dialog
- Case 2
- ' forward message
- MAPIMessages1.MsgIndex = List1.ListIndex ' point to msg
- MAPIMessages1.Forward ' copy as forwarded in to buffer
- MAPIMessages1.Send True ' start dialog
- Case 3
- ' reply to message
- MAPIMessages1.MsgIndex = List1.ListIndex ' point to msg
- MAPIMessages1.Reply ' copy as reply into buffer
- MAPIMessages1.Send True ' start server dialog
- Case 4
- ' reply to all senders
- MAPIMessages1.MsgIndex = List1.ListIndex ' point to msg
- MAPIMessages1.ReplyAll ' copy as reply aal into buffer
- MAPIMessages1.Send True ' start server dialog
- Case 5
- ' delete message
- nTemp = MsgBox("Delete Current Message?", vbYesNo, "Delete Message")
- If nTemp = vbYes Then ' if confirmed delete
- MAPIMessages1.MsgIndex = List1.ListIndex ' point to msg
- MAPIMessages1.Delete ' tell server to delete msg
- GetMessages ' refresh local list
- End If
- Case 6
- ' read message
- MAPIMessages1.MsgIndex = List1.ListIndex ' point to msg
- Reader.Show vbModal ' start read form
- Case 7
- ' address book
- MAPIMessages1.Show ' show book
- Case 8
- ' exit program
- nTemp = MsgBox("Exit Program?", vbInformation + vbYesNo, "Program Exit")
- If nTemp = vbYes Then ' if confirmed exit
- Unload Me ' shut down
- End If
- End Select
- '
- Exit Sub
- '
- Command1ClickErr:
- MsgBox Error$, vbCritical, "Error Code: " + Str(Err)
- '
- End Sub
- Private Sub Form_Load()
- '
- ' attempt signon
- '
- On Error GoTo FormLoadErr
- '
- MAPISession1.SignOn ' tell server to log me in
- MAPIMessages1.SessionID = MAPISession1.SessionID
- GetMessages ' get lost of messages
- '
- Exit Sub
- '
- FormLoadErr:
- MsgBox Error$, vbCritical, "Error Code " + Str(Err)
- Unload Me
- End
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- '
- On Error Resume Next
- MAPISession1.SignOff
- '
- End Sub
- Public Sub GetMessages()
- '
- ' get all unread stuff fro this user
- '
- Dim x As Integer
- Dim cLine As String
- '
- On Error GoTo GetMessagesErr
- '
- MAPIMessages1.Fetch ' get messages from server
- '
- List1.Clear ' clear local list control
- If MAPIMessages1.MsgCount > 0 Then ' got at least one?
- For x = 0 To MAPIMessages1.MsgCount - 1
- MAPIMessages1.MsgIndex = x ' move pointer
- cLine = MAPIMessages1.MsgSubject ' get subject
- List1.AddItem cLine ' add to list control
- Next x
- End If
- '
- Exit Sub
- '
- GetMessagesErr:
- MsgBox Error$, vbCritical, "Error Code: " + Str(Err)
- Unload Me
- '
- End Sub
- Private Sub List1_DblClick()
- Command1_Click 6 ' read message
- End Sub
-