home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form MsgForm
- Caption = "Reading Incoming Messages"
- ClientHeight = 6405
- ClientLeft = 60
- ClientTop = 375
- ClientWidth = 10335
- LinkTopic = "Form1"
- ScaleHeight = 6405
- ScaleWidth = 10335
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command1
- Caption = "E X I T"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 480
- Left = 8490
- TabIndex = 19
- Top = 5775
- Width = 1740
- End
- Begin VB.TextBox txtBody
- BackColor = &H00C0C0C0&
- BeginProperty Font
- Name = "Verdana"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2115
- Left = 4350
- Locked = -1 'True
- MultiLine = -1 'True
- ScrollBars = 3 'Both
- TabIndex = 18
- Top = 3390
- Width = 5730
- End
- Begin VB.CommandButton Command4
- Caption = "Attachments"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 360
- TabIndex = 9
- Top = 4920
- Width = 1815
- End
- Begin VB.CommandButton Command3
- Caption = "Show Selected Messages"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 6960
- TabIndex = 7
- Top = 2040
- Width = 2895
- End
- Begin VB.ListBox List1
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2160
- Left = 105
- TabIndex = 6
- Top = 285
- Width = 5295
- End
- Begin VB.CheckBox chkCompany
- Caption = "From this sender"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 5880
- TabIndex = 5
- Top = 240
- Width = 2175
- End
- Begin VB.ComboBox Combo1
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 330
- Left = 6720
- Sorted = -1 'True
- TabIndex = 4
- Top = 600
- Width = 3135
- End
- Begin VB.TextBox DateTo
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 285
- Left = 8760
- TabIndex = 3
- Text = "12/31/98"
- Top = 1440
- Width = 1095
- End
- Begin VB.TextBox DateFrom
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 285
- Left = 6720
- TabIndex = 1
- Text = "1/1/97"
- Top = 1440
- Width = 1095
- End
- Begin VB.CheckBox chkDate
- Caption = "Between these dates"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 5880
- TabIndex = 0
- Top = 1080
- Width = 2415
- End
- Begin VB.Label Label8
- Caption = "Selected Messages"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 105
- TabIndex = 20
- Top = 0
- Width = 2985
- End
- Begin VB.Label lblSender
- BorderStyle = 1 'Fixed Single
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 1200
- TabIndex = 17
- Top = 3600
- Width = 2775
- End
- Begin VB.Label Label2
- Caption = "Date Sent"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 360
- TabIndex = 16
- Top = 3960
- Width = 1095
- End
- Begin VB.Label Label3
- Caption = "Sender"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 360
- TabIndex = 15
- Top = 3600
- Width = 735
- End
- Begin VB.Label lblSent
- BorderStyle = 1 'Fixed Single
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 2520
- TabIndex = 14
- Top = 3960
- Width = 1455
- End
- Begin VB.Label lblRecvd
- BorderStyle = 1 'Fixed Single
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 2520
- TabIndex = 13
- Top = 4320
- Width = 1455
- End
- Begin VB.Label Label6
- Alignment = 2 'Center
- Caption = "Selected Message Information"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 360
- TabIndex = 12
- Top = 3000
- Width = 3615
- End
- Begin VB.Label Label4
- Caption = "Date Received"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 360
- TabIndex = 11
- Top = 4320
- Width = 1575
- End
- Begin VB.Label Label5
- Caption = "Message Body"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 4320
- TabIndex = 10
- Top = 3000
- Width = 1695
- End
- Begin VB.Label Label7
- BorderStyle = 1 'Fixed Single
- Height = 2895
- Left = 120
- TabIndex = 8
- Top = 2760
- Width = 10095
- End
- Begin VB.Label Label1
- Caption = "and"
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 8040
- TabIndex = 2
- Top = 1455
- Width = 495
- End
- Attribute VB_Name = "MsgForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' ******************************
- ' ******************************
- ' ** MASTERING VB6 **
- ' ** by Evangelos Petroutos **
- ' ** SYBEX, 1998 **
- ' ******************************
- ' ******************************
- Dim OLApp As Application
- Dim mNameSpace As NameSpace
- Dim mFolder As MAPIFolder
- Dim mItem As MailItem
- Dim mMessage As Items
- Dim AllMessages As Items
- Dim SelectedMessages As New Collection
- Dim AllContacts As Items
- Dim MessageAttachments As Attachments
- Private Sub Command1_Click()
- OLApp.Quit
- Set OLApp = Nothing
- End
- End Sub
- Private Sub Command3_Click()
- Dim CompanyName As String
- Dim filterString As String
- Dim thismessage As Object
- Dim msgContact As Object
- Dim SenderName As String
- ' Clear Collection of selected messages
- For i = SelectedMessages.Count To 1 Step -1
- SelectedMessages.Remove i
- Next
- ' Valdate data
- If Not (IsDate(DateFrom.Text) And IsDate(DateTo.Text)) Then
- MsgBox "One of the dates you specified is invalid"
- Exit Sub
- End If
- If chkCompany.Value And Combo1.ListIndex >= 0 Then
- ContactName = Combo1.Text
- filterString = "[SenderName] = """ & ContactName & """"
- End If
- If chkDate.Value Then
- If filterString = "" Then
- filterString = "[SentOn] > """ & DateFrom.Text & """ And [SentOn] < """ & DateTo.Text & """"
- Else
- filterString = filterString & " and [SentOn] > """ & DateFrom.Text & """ And [SentOn] < """ & DateTo.Text & """"
- End If
- End If
- If filterString = "" Then
- filterString = "[SentOn] > ""01/01/1980"""
- End If
- Set thismessage = AllMessages.Find(filterString)
- If thismessage Is Nothing Then
- MsgBox "No messages sent in the specified interval."
- Else
- List1.Clear
- While Not thismessage Is Nothing
- List1.AddItem thismessage.SenderName & Chr(9) & thismessage.Subject
- SelectedMessages.Add thismessage
- Set thismessage = AllMessages.FindNext
- Wend
-
- End If
- End Sub
- Private Sub Command4_Click()
- Dim thisAttachment As Attachment
- Dim msg As String
- msg = "The selected message contains the following attachments:"
- For Each thisAttachment In MessageAttachments
- msg = msg & vbCrLf & thisAttachment.PathName & " (" & thisAttachment.Type & ")"
- Next
- MsgBox msg
- End Sub
- Private Sub Form_Load()
- On Error GoTo OutlookNotStarted
- Set OLApp = CreateObject("Outlook.Application")
- On Error GoTo NoMAPINameSpace
- Set mNameSpace = OLApp.GetNamespace("MAPI")
- Set AllMessages = mNameSpace.GetDefaultFolder(olFolderInbox).Items
- Set AllContacts = mNameSpace.GetDefaultFolder(olFolderContacts).Items
- Combo1.Clear
- For Each mcontact In AllContacts
- Combo1.AddItem mcontact.FullName
- If Combo1.List(Combo1.NewIndex) = Combo1.List(Combo1.NewIndex + 1) Then Combo1.RemoveItem Combo1.NewIndex
- Next
- Combo1.ListIndex = 0
- Exit Sub
- OutlookNotStarted:
- MsgBox "Could not start Outlook"
- Exit Sub
- NoMAPINameSpace:
- MsgBox "Could not get MAPI NameSpace"
- Exit Sub
- End Sub
- Private Sub List1_Click()
- Dim thismessage As Object
- Dim MessageAttachments As Attachments
- selectedEntry = List1.ListIndex + 1
- If selectedEntry < 1 Then Exit Sub
- Set thismessage = SelectedMessages.Item(selectedEntry)
- lblSender.Caption = " " & thismessage.SenderName
- lblSent.Caption = " " & thismessage.SentOn
- lblRecvd.Caption = " " & thismessage.ReceivedTime
- txtBody.Text = " " & thismessage.Body
- Set MessageAttachments = thismessage.Attachments
- If MessageAttachments.Count = 0 Then
- Command4.Enabled = False
- Else
- Command4.Enabled = False
- End If
- End Sub
-