?? newmsg.frm
字號:
VERSION 5.00
Begin VB.Form NewMsg
Caption = "寫信件"
ClientHeight = 7380
ClientLeft = 60
ClientTop = 345
ClientWidth = 7380
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 7380
ScaleWidth = 7380
WindowState = 2 'Maximized
Begin VB.ListBox alist
Height = 450
Left = 360
TabIndex = 12
Top = 6600
Width = 6360
End
Begin VB.CommandButton Send
Caption = "發送"
Height = 375
Left = 960
TabIndex = 8
Top = 5520
Width = 1215
End
Begin VB.CommandButton Attach
Caption = "附件"
Height = 375
Left = 5040
TabIndex = 7
Top = 5520
Width = 1215
End
Begin VB.CommandButton CompOpt
Caption = "設置"
Height = 375
Left = 1680
TabIndex = 6
Top = 240
Width = 1215
End
Begin VB.CommandButton ChkNames
Caption = "驗證地址"
Height = 375
Left = 3120
TabIndex = 5
Top = 5520
Width = 1215
End
Begin VB.CommandButton CompAdd
Caption = "通訊簿"
Height = 375
Left = 4440
TabIndex = 4
Top = 240
Width = 1215
End
Begin VB.TextBox txtNoteText
Height = 3135
Left = 360
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Text = "NewMsg.frx":0000
Top = 2160
Width = 6330
End
Begin VB.TextBox txtSubject
Height = 270
Left = 1335
TabIndex = 2
Text = "txtSubject"
Top = 1680
Width = 4575
End
Begin VB.TextBox txtCc
Height = 270
Left = 1335
TabIndex = 1
Text = "txtCc"
Top = 1320
Width = 4575
End
Begin VB.TextBox txtTo
Height = 270
Left = 1335
TabIndex = 0
Text = "txtTo"
Top = 960
Width = 4575
End
Begin VB.Label numAtt
Caption = "numAtt"
Height = 375
Left = 360
TabIndex = 13
Top = 6120
Width = 1530
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
Caption = "主題:"
Height = 255
Left = 255
TabIndex = 11
Top = 1680
Width = 975
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "抄送:"
Height = 255
Left = 615
TabIndex = 10
Top = 1320
Width = 615
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "收信人:"
Height = 255
Left = 435
TabIndex = 9
Top = 960
Width = 795
End
End
Attribute VB_Name = "NewMsg"
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
VBMail.CMDialog1.DialogTitle = "附件"
VBMail.CMDialog1.Filter = "All Files(*.*)|*.*|Text Files(*.txxt)|*.txt"
VBMail.CMDialog1.ShowOpen
If Err = 0 Then
On Error GoTo 0
VBMail.MAPIMess.AttachmentIndex = VBMail.MAPIMess.AttachmentCount
VBMail.MAPIMess.AttachmentName = VBMail.CMDialog1.FileTitle
VBMail.MAPIMess.AttachmentPathName = VBMail.CMDialog1.FileName
VBMail.MAPIMess.AttachmentPosition = VBMail.MAPIMess.AttachmentIndex
VBMail.MAPIMess.AttachmentType = vbAttachTypeData
alist.AddItem (VBMail.MAPIMess.AttachmentPathName)
numAtt.Caption = "附加文件的數量為:" + Str$(VBMail.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)
VBMail.MAPIMess.Action = vbMessageShowADBook
Call UpdateRecips(Me)
End Sub
Private Sub CompOpt_Click()
'顯示收發郵件設置對話框窗體MailOptFrm
OptionType = conOptionMessage
MailOptFrm.Show 1
End Sub
Private Sub Form_Activate()
'設置書寫緩沖區有效
VBMail.MAPIMess.MsgIndex = -1
End Sub
Private Sub Form_Load()
VBMail.Toolbar1.Visible = False
frmoldwidth = NewMsg.Width
frmoldheight = NewMsg.Height
txtoldheight = txtNoteText.Height
VBMail.Height = 5580
VBMail.Width = 7000
End Sub
Private Sub Form_Resize()
'當窗體的大小發生改變時調整窗體中各控件的尺寸和位置
If WindowState = 0 Then
NewMsg.Width = frmoldwidth
If NewMsg.Height < frmoldheight Then
NewMsg.Height = frmoldheight
Else
txtNoteText.Height = txtoldheight + NewMsg.Height - frmoldheight
End If
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
VBMail.Toolbar1.Visible = True
End Sub
Private Sub Send_Click()
'發送郵件子程序
If VBMail.MAPIMess.AttachmentCount > 0 Then
txtNoteText.Text = String$(VBMail.MAPIMess.AttachmentCount, "*") + txtNoteText.Text
End If
'根據書寫的消息設置MAPIMessages控件相應的屬性
VBMail.MAPIMess.MsgSubject = txtSubject.Text
VBMail.MAPIMess.MsgNoteText = txtNoteText.Text
VBMail.MAPIMess.MsgReceiptRequested = ReturnRequest
Call CopyNamestoMsgBuffer(Me, True)
On Error Resume Next
'發送郵件
VBMail.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 + -