?? main.frm
字號:
VERSION 5.00
Object = "{20C62CAE-15DA-101B-B9A8-444553540000}#1.1#0"; "MSMAPI32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.MDIForm Main
BackColor = &H8000000C&
Caption = "收發郵件程序"
ClientHeight = 5265
ClientLeft = 165
ClientTop = 735
ClientWidth = 7560
LinkTopic = "MDIForm1"
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Interval = 1000
Left = 6840
Top = 1200
End
Begin MSComDlg.CommonDialog CMDialog1
Left = 6120
Top = 1080
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComctlLib.StatusBar Statusbar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 1
Top = 4890
Width = 7560
_ExtentX = 13335
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 2
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 10266
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Alignment = 2
AutoSize = 2
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 570
Left = 0
TabIndex = 0
Top = 0
Width = 7560
_ExtentX = 13335
_ExtentY = 1005
ButtonWidth = 1138
ButtonHeight = 953
Wrappable = 0 'False
Appearance = 1
Style = 1
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 18
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "登錄"
Key = "Login"
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "寫信"
Key = "Compose"
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "收信"
Key = "Fetch"
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "回復"
Key = "Reply"
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "發送"
Key = "Forward"
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "刪除"
Key = "Delete"
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "前一封"
Key = "Previous1"
EndProperty
BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button15 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "下一封"
Key = "Next1"
EndProperty
BeginProperty Button16 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button17 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "Exit1"
EndProperty
BeginProperty Button18 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
EndProperty
BorderStyle = 1
End
Begin MSMAPI.MAPISession MAPISess
Left = 5400
Top = 1080
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DownloadMail = -1 'True
LogonUI = -1 'True
NewSession = 0 'False
End
Begin MSMAPI.MAPIMessages MAPIMess
Left = 4680
Top = 1080
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
AddressEditFieldCount= 1
AddressModifiable= 0 'False
AddressResolveUI= 0 'False
FetchSorted = 0 'False
FetchUnreadOnly = 0 'False
End
Begin VB.Menu file
Caption = "文件(&F)"
Begin VB.Menu Logon
Caption = "登錄"
End
Begin VB.Menu Logoff
Caption = "注銷"
End
Begin VB.Menu PrintMessage
Caption = "打印"
End
Begin VB.Menu Exit
Caption = "退出"
End
End
Begin VB.Menu Option
Caption = "選項(&O)"
Begin VB.Menu PrSetup
Caption = "打印設置"
End
Begin VB.Menu FontScreen
Caption = "窗體字體設置"
End
Begin VB.Menu FontPrt
Caption = "打印字體設置"
End
End
Begin VB.Menu Address
Caption = "通訊簿(&B)"
Begin VB.Menu ShowAB
Caption = "顯示通訊簿"
End
End
Begin VB.Menu Window
Caption = "窗口(&W)"
Begin VB.Menu Wa
Caption = "層疊"
Index = 0
End
Begin VB.Menu Wa
Caption = "水平平鋪"
Index = 1
End
Begin VB.Menu Wa
Caption = "垂直平鋪"
Index = 2
End
Begin VB.Menu Wa
Caption = "排列圖標"
Index = 3
End
End
End
Attribute VB_Name = "Main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub MDIForm_Load()
'進入程序,初始化各菜單,按扭的可用狀態
Logoff.Enabled = False
Statusbar1.Panels(2) = Time$
Statusbar1.Panels(1) = "離線狀態"
SendWithMapi = True
ShowAB.Enabled = False
Main.Toolbar1.Buttons("Compose").Enabled = False
Main.Toolbar1.Buttons("Fetch").Enabled = False
Main.Toolbar1.Buttons("Reply").Enabled = False
Main.Toolbar1.Buttons("Forward").Enabled = False
Main.Toolbar1.Buttons("Delete").Enabled = False
Main.Toolbar1.Buttons("Previous1").Enabled = False
Main.Toolbar1.Buttons("Next1").Enabled = False
Main.PrintMessage.Enabled = False
Main.MAPISess.LogonUI = True
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error Resume Next
Select Case Button.Key
Case "Login"
Call Logon_Click
Case "Fetch"
Call Mfetch_Click
Case "Compose"
Call Mcompose_Click
Case "Reply"
Call Mreply_Click
Case "Forward"
Call Mforward_Click
Case "Exit1"
Call Exit_Click
Case "Previous1"
'查看前一封郵件
If Form1.Mlist.ListCount <> 0 Then
Form1.Mlist.ItemData(Form1.Mlist.ListIndex) = False
Form1.Mlist.ListIndex = Form1.Mlist.ListIndex - 1
End If
Call ViewNextMsg
Case "Next1"
'查看下一封郵件
If Form1.Mlist.ListIndex <> Form1.Mlist.ListCount - 1 Then
Form1.Mlist.ItemData(Form1.Mlist.ListIndex) = False
Form1.Mlist.ListIndex = Form1.Mlist.ListIndex + 1
End If
Call ViewNextMsg
Case "Delete"
'刪除當前的郵件
If TypeOf Main.ActiveForm Is Form2 Then
Call DeleteMessage
ElseIf TypeOf Main.ActiveForm Is Form1 Then
Main.MAPIMess.MsgIndex = Form1.Mlist.ListIndex
Call DeleteMessage
End If
End Select
End Sub
Private Sub EditDelete_Click()
'刪除郵件
On Error GoTo trap
If TypeOf Main.ActiveForm Is Form1 Then
Main.MAPIMess.MsgIndex = Form1.Mlist.ListIndex
Call DeleteMessage
End If
trap:
Exit Sub
End Sub
Private Sub Exit_Click()
'退出功能,如果對話未關閉,則調用logoff_Click關閉郵件對話
If MAPISess.SessionID <> 0 Then
Call Logoff_Click
End If
End
End Sub
Private Sub FontPrt_Click()
'打印字體設置
On Error Resume Next
CMDialog1.Flags = 1
CMDialog1.FontName = Printer.FontName
CMDialog1.FontSize = Printer.FontSize
CMDialog1.FontBold = Printer.FontBold
CMDialog1.FontItalic = Printer.FontItalic
CMDialog1.ShowFont
If Err = 0 Then
Printer.FontName = CMDialog1.FontName
Printer.FontSize = CMDialog1.FontSize
Printer.FontBold = CMDialog1.FontBold
Printer.FontItalic = CMDialog1.FontItalic
End If
End Sub
Private Sub FontScreen_Click()
'活動窗體中具有輸入焦點控件的字體設置
On Error Resume Next
CMDialog1.Flags = 1
CMDialog1.FontName = Main.ActiveForm.ActiveControl.FontName
CMDialog1.FontSize = Main.ActiveForm.ActiveControl.FontSize
CMDialog1.FontBold = Main.ActiveForm.ActiveControl.FontBold
CMDialog1.FontItalic = Main.ActiveForm.ActiveControl.FontItalic
CMDialog1.ShowFont
If Err = 0 Then
Main.ActiveForm.ActiveControl.FontName = CMDialog1.FontName
Main.ActiveForm.ActiveControl.FontSize = CMDialog1.FontSize
Main.ActiveForm.ActiveControl.FontBold = CMDialog1.FontBold
Main.ActiveForm.ActiveControl.FontItalic = CMDialog1.FontItalic
End If
End Sub
Private Sub Logoff_Click()
'關閉郵件對話,注銷用戶
Call LogOffUser
End Sub
Private Sub Logon_Click()
'登錄
On Error Resume Next
'打開郵件對話
MAPISess.Action = 1
If Err <> 0 Then
MsgBox "登錄失?。。?!" + Error$
Else
Screen.MousePointer = 11
MAPIMess.SessionID = MAPISess.SessionID
'取得郵箱中郵件的數量
GetMessageCount
Screen.MousePointer = 11
'將郵件的信息裝載到郵件列表窗體中的列表框
Call LoadList(MAPIMess)
Screen.MousePointer = 0
'設置各個按扭及菜單的可用狀態
Logon.Enabled = False
Logoff.Enabled = True
ShowAB.Enabled = True
Main.Toolbar1.Buttons("Compose").Enabled = True
Main.Toolbar1.Buttons("Fetch").Enabled = True
Main.Toolbar1.Buttons("ReplyAll").Enabled = True
Main.Toolbar1.Buttons("Reply").Enabled = True
Main.Toolbar1.Buttons("Forward").Enabled = True
Main.Toolbar1.Buttons("Delete").Enabled = True
Main.Toolbar1.Buttons("Previous1").Enabled = False
Main.Toolbar1.Buttons("Next1").Enabled = True
Main.PrintMessage.Enabled = True
End If
End Sub
Private Sub MailOpts_Click()
'調用收發郵件設置對話框
OptionType = conOptionGeneral
MailOptFrm.Show
End Sub
Private Sub Mcompose_Click()
'撰寫新郵件
Main.MAPIMess.Action = 6
'使用設計的窗體Form3撰寫及發送電子郵件
Call LoadMessage(-1, Form3)
End Sub
Private Sub Mfetch_Click()
'讀取郵件
Main.MAPIMess.Action = 1
'取得郵箱中郵件的數量
GetMessageCount
'將郵件信息裝載到郵件列表窗體中
Call LoadList(MAPIMess)
End Sub
Private Sub Mforward_Click()
'轉發郵件
'取得郵件的正文及郵件頭
svNote = Main.MAPIMess.MsgNoteText
svNote = GetHeader(Main.MAPIMess) + svNote
'發送
Main.MAPIMess.Action = 9
Main.MAPIMess.MsgNoteText = svNote
If SendWithMapi Then
'使用MAPI對話框撰寫及轉發電子郵件
Main.MAPIMess.Action = vbMessageSenddlg
Else
'使用設計的窗體Form3撰寫及轉送電子郵件
Call LoadMessage(-1, Form3)
End If
End Sub
Private Sub Mreply_Click()
'回復郵件
'取得郵件的正文及郵件頭
svNote = Main.MAPIMess.MsgNoteText
svNote = GetHeader(Main.MAPIMess) + svNote
'回復
Main.MAPIMess.Action = 7
Main.MAPIMess.MsgNoteText = svNote
If SendWithMapi Then
'使用MAPI對話框撰寫及回復電子郵件
Main.MAPIMess.Action = vbMessageSenddlg
Else
'使用設計的窗體Form3撰寫及回復電子郵件
Call LoadMessage(-1, Form3)
End If
End Sub
Private Sub Mreplyall_Click()
End Sub
Private Sub PrintMessage_Click()
'打印郵件
Call Printmail
End Sub
Private Sub PrSetup_Click()
'打印機設置
On Error Resume Next
CMDialog1.Flags = &H40
CMDialog1.ShowPrinter
End Sub
Private Sub ShowAB_Click()
'顯示地址簿
On Error Resume Next
Main.MAPIMess.Action = vbMessageShowADBook
If Err Then
If errr <> 32001 Then
MsgBox "error:" + Error$ + "occured trying to show the address book"
End If
Else
'更新收信人地址
If TypeOf Main.ActiveForm Is Form3 Then
Call UpdateRecips(Main.ActiveForm)
End If
End If
End Sub
Private Sub Timer1_Timer()
Statusbar1.Panels(2) = Time$
End Sub
Private Sub Wa_Click(Index As Integer)
'排列子窗體
Main.Arrange Index
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -