Private Sub Command1_Click()
If Val(Text2.Text) <= 0 Then Exit Sub
Text2.Text = Val(Text2.Text) - 1
Call xs ()
End Sub
Private Sub Command2_Click()
If Val(Text2.Text) >= Val(Text1.Text) - 1 Then Exit Sub
Text2.Text = Val(Text2.Text) + 1
Call xs()
End Sub
Private Sub Command3_Click()
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.MsgIndex = -1 ′ 建立发送缓冲区
MAPIMessages1.Compose ′ 写新邮件
MAPIMessages1.Send True
End Sub
Private Sub xs()
MAPIMessages1.MsgIndex = Val(Text2.Text) ′ 指定电子邮件
Text3.Text = MAPIMessages1.MsgSubject ′ 电子邮件主题
Text4.Text = MAPIMessages1.MsgOrigDisplayName
′ 电子邮件发信人姓名
Text5.Text = MAPIMessages1.MsgNoteText ′ 电子邮件全文
End Sub
Private Sub Command4_Click()
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.MsgIndex = Val(Text2.Text)
MAPIMessages1.Reply
MAPIMessages1.Send True
End Sub
Private Sub Command5_Click()
MAPISession1.SignOff
MAPISession1.DownLoadMail = True
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.FetchUnreadOnly = False
MAPIMessages1.Fetch
Text1.Text = MAPIMessages1.MsgCount
Text2.Text = 0
End Sub
Private Sub Command6_Click()
On Error GoTo err:
MAPIMessages1.Show
err:
End Sub
Private Sub Form_Activate()
Call xs
End Sub
Private Sub Form_Load() ′ 系统初始化
MAPISession1.DownLoadMail = False
MAPISession1.SignOn ′ 处理开始
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.FetchUnreadOnly = False
MAPIMessages1.Fetch
Text1.Text = MAPIMessages1.MsgCount
Text2.Text = 0
End Sub
Private Sub Command7_Click()
MAPISession1.SignOff ′ 处理结束
End
End Sub
好了,代码终于写完了,运行一下,看看效果,还不错吧!当然,如果你想更完善一些,就需要你自己努力了。本程序在Windows XP下运行通过。