📄 form3.frm
字号:
VERSION 5.00
Begin VB.Form Form3
Caption = "写信件"
ClientHeight = 6720
ClientLeft = 60
ClientTop = 345
ClientWidth = 7380
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 6720
ScaleWidth = 7380
WindowState = 2 'Maximized
Begin VB.ListBox alist
Height = 420
Left = 240
TabIndex = 11
Top = 5880
Width = 6360
End
Begin VB.CommandButton Send
Caption = "发送"
Height = 375
Left = 840
TabIndex = 7
Top = 4800
Width = 1215
End
Begin VB.CommandButton Attach
Caption = "附件"
Height = 375
Left = 4920
TabIndex = 6
Top = 4800
Width = 1215
End
Begin VB.CommandButton ChkNames
Caption = "验证地址"
Height = 375
Left = 3000
TabIndex = 5
Top = 4800
Width = 1215
End
Begin VB.CommandButton CompAdd
Caption = "通讯簿"
Height = 375
Left = 5880
TabIndex = 4
Top = 120
Width = 1215
End
Begin VB.TextBox txtNoteText
Height = 3135
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Top = 1440
Width = 6330
End
Begin VB.TextBox txtSubject
Height = 270
Left = 1215
TabIndex = 2
Text = "txtSubject"
Top = 960
Width = 4575
End
Begin VB.TextBox txtCc
Height = 270
Left = 1215
TabIndex = 1
Text = "txtCc"
Top = 600
Width = 4575
End
Begin VB.TextBox txtTo
Height = 270
Left = 1215
TabIndex = 0
Text = "txtTo"
Top = 240
Width = 4575
End
Begin VB.Label numAtt
Caption = "numAtt"
Height = 375
Left = 240
TabIndex = 12
Top = 5400
Width = 1530
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
Caption = "主题:"
Height = 255
Left = 135
TabIndex = 10
Top = 960
Width = 975
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "抄送:"
Height = 255
Left = 495
TabIndex = 9
Top = 600
Width = 615
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "收信人:"
Height = 255
Left = 315
TabIndex = 8
Top = 240
Width = 795
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim frmoldwidth
Dim frmoldheight
Dim txtoldheight
Private Sub Attach_Click()
'显示通用对话框选取附加文件
On Error Resume Next
Main.CMDialog1.DialogTitle = "附件"
Main.CMDialog1.Filter = "All Files(*.*)|*.*|Text Files(*.txxt)|*.txt"
Main.CMDialog1.ShowOpen
If Err = 0 Then
On Error GoTo 0
Main.MAPIMess.AttachmentIndex = Main.MAPIMess.AttachmentCount
Main.MAPIMess.AttachmentName = Main.CMDialog1.FileTitle
Main.MAPIMess.AttachmentPathName = Main.CMDialog1.FileName
Main.MAPIMess.AttachmentPosition = Main.MAPIMess.AttachmentIndex
Main.MAPIMess.AttachmentType = vbAttachTypeData
alist.AddItem (Main.MAPIMess.AttachmentPathName)
numAtt.Caption = "附加文件的数量为:" + Str$(Main.MAPIMess.AttachmentCount)
End If
End Sub
Private Sub ChkNames_Click()
'验证并更新收信人地址
Call CopyNamestoMsgBuffer(Me, True)
Call UpdateRecips(Me)
End Sub
Private Sub CompAdd_Click()
'打开地址簿选择收信人地址
Call CopyNamestoMsgBuffer(Me, False)
Main.MAPIMess.Action = vbMessageShowADBook
Call UpdateRecips(Me)
End Sub
Private Sub CompOpt_Click()
'显示收发邮件设置对话框窗体MailOptFrm
OptionType = conOptionMessage
MailOptFrm.Show 1
End Sub
Private Sub Form_Activate()
'设置书写缓冲区有效
Main.MAPIMess.MsgIndex = -1
End Sub
Private Sub Form_Load()
Main.Toolbar1.Visible = False
frmoldwidth = Form3.Width
frmoldheight = Form3.Height
txtoldheight = txtNoteText.Height
Main.Height = 5580
Main.Width = 7000
End Sub
Private Sub Form_Resize()
'当窗体的大小发生改变时调整窗体中各控件的尺寸和位置
If WindowState = 0 Then
Form3.Width = frmoldwidth
If Form3.Height < frmoldheight Then
Form3.Height = frmoldheight
Else
txtNoteText.Height = txtoldheight + Form3.Height - frmoldheight
End If
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Main.Toolbar1.Visible = True
End Sub
Private Sub Send_Click()
'发送邮件子程序
If Main.MAPIMess.AttachmentCount > 0 Then
txtNoteText.Text = String$(Main.MAPIMess.AttachmentCount, "*") + txtNoteText.Text
End If
'根据书写的消息设置MAPIMessages控件相应的属性
Main.MAPIMess.MsgSubject = txtSubject.Text
Main.MAPIMess.MsgNoteText = txtNoteText.Text
Main.MAPIMess.MsgReceiptRequested = ReturnRequest
Call CopyNamestoMsgBuffer(Me, True)
On Error Resume Next
'发送邮件
Main.MAPIMess.Action = vbMessageSend
If Err Then
MsgBox "邮件发送过程中出现了一个错误" + Str$(Err)
Else
'发送成功后退出书写消息的窗体
Unload Me
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -