⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messenger.frm

📁 vb开发的消息传递系统
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Object = "{20C62CAE-15DA-101B-B9A8-444553540000}#1.1#0"; "MSMAPI32.OCX"
Begin VB.Form frmNetMessenger 
   BackColor       =   &H00C0C0C0&
   Caption         =   "Net Messenger"
   ClientHeight    =   3150
   ClientLeft      =   1080
   ClientTop       =   1770
   ClientWidth     =   7350
   FillColor       =   &H00FFFFFF&
   ForeColor       =   &H00C00000&
   Icon            =   "messenger.frx":0000
   LinkTopic       =   "Form1"
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   3150
   ScaleWidth      =   7350
   Begin VB.TextBox TxtMessage 
      BackColor       =   &H00E0E0E0&
      ForeColor       =   &H00000000&
      Height          =   2055
      Left            =   0
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   0
      Top             =   1080
      Width           =   7335
   End
   Begin MSMAPI.MAPISession MAPISession1 
      Left            =   720
      Top             =   3240
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      DownloadMail    =   -1  'True
      LogonUI         =   -1  'True
      NewSession      =   -1  'True
   End
   Begin MSMAPI.MAPIMessages MAPIMessages1 
      Left            =   1440
      Top             =   3240
      _ExtentX        =   1005
      _ExtentY        =   1005
      _Version        =   393216
      AddressEditFieldCount=   1
      AddressModifiable=   0   'False
      AddressResolveUI=   0   'False
      FetchSorted     =   0   'False
      FetchUnreadOnly =   0   'False
   End
   Begin MSComDlg.CommonDialog CMDialog1 
      Left            =   120
      Top             =   3240
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      CancelError     =   -1  'True
   End
   Begin VB.Label lblHdr1 
      BackColor       =   &H00FF0000&
      Caption         =   "Message to send:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0080FFFF&
      Height          =   255
      Left            =   0
      TabIndex        =   1
      Top             =   840
      Width           =   3735
   End
   Begin VB.Shape Shape1 
      BackColor       =   &H00FF0000&
      BackStyle       =   1  'Opaque
      Height          =   255
      Left            =   0
      Top             =   840
      Width           =   7335
   End
   Begin VB.Menu mnuLogOn 
      Caption         =   "&Log ON"
   End
   Begin VB.Menu mnuSelectAddress 
      Caption         =   "Select A&ddress"
   End
   Begin VB.Menu mnuSendMessage 
      Caption         =   "&Send Message"
   End
   Begin VB.Menu mnuAttachment 
      Caption         =   "Send &Attachment"
   End
   Begin VB.Menu mnuExit 
      Caption         =   "&Exit"
   End
End
Attribute VB_Name = "frmNetMessenger"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'####################################################
'# Created by Russell B.      E-MAIL MESSENGER      #
'# 05/28/2000                                       #
'# This is a simple e-mail program                  #
'# that enables user to log into e-mail service     #
'# and send files and messages.                     #
'# created in VB5.0       e-mail rsnob666@home.com  #
'####################################################
Option Explicit
Dim gAddress
Dim gAttach
Dim gSend
Private Sub Form_Load()
gAddress = 0
gAttach = 0
gSend = 0
End Sub
Private Sub mnuAttachment_Click()
If gAttach = 0 Then
  MsgBox " Please Log ON and select an address before attaching."
  Exit Sub
End If

CMDialog1.DialogTitle = "Attach a file to your message"
CMDialog1.Filter = "All Files (*.*)|*.*|Test Files(*.txt)|*.txt|WAV Files (*.wav)|*.wav"
   On Error GoTo DialogError
   
   CMDialog1.Action = 1
MAPIMessages1.AttachmentIndex = MAPIMessages1.AttachmentCount

MAPIMessages1.AttachmentName = CMDialog1.FileTitle
MAPIMessages1.AttachmentPathName = CMDialog1.filename
MAPIMessages1.AttachmentPosition = MAPIMessages1.AttachmentIndex

' 0 is mapi_att_file
MAPIMessages1.AttachmentType = 0

gSend = 1
Exit Sub

DialogError:
    MsgBox "Error", 64, "No file was attached"
    gAddress = 0
    gAttach = 0
    gSend = 0
Exit Sub

End Sub
Private Sub mnuExit_Click()
  End
End Sub
Private Sub mnuLogOn_Click()
If mnuLogOn.Caption = "&Log ON" Then
'get user password and account name.
MAPISession1.LogonUI = True

On Error GoTo DidNotLogOn
'log on.
MAPISession1.Action = 1
MAPIMessages1.SessionID = MAPISession1.SessionID

mnuLogOn.Caption = "&Log OFF"
gAddress = 1
gAttach = 0
gSend = 0

Else
' User is now logging off
MAPISession1.Action = 2
MAPIMessages1.SessionID = 0

mnuLogOn.Caption = "&Log ON"
gAddress = 0
gAttach = 0
gSend = 0

End If
Exit Sub
DidNotLogOn:
MsgBox "Did not Log ON"
gAddress = 0
gAttach = 0
gSend = 0

Exit Sub

End Sub
Private Sub mnuSelectAddress_Click()
If gAddress = 0 Then
   MsgBox " Please Log on before selecting an address."
   Exit Sub
End If

MAPIMessages1.MsgIndex = -1
MAPIMessages1.AddressEditFieldCount = 1
On Error GoTo ActionError

'' 11 is the MESSAGE_SHOWADBOOK
MAPIMessages1.Action = 11
gSend = 1
gAttach = 1
Exit Sub

ActionError:
  MsgBox " Error"
  gAddress = 0
  gAttach = 0
  gSend = 0
  Exit Sub

End Sub
Private Sub mnuSendMessage_Click()
If gSend = 0 Then
   MsgBox " Please Log ON and select an address before sending"
   Exit Sub
End If
MAPIMessages1.MsgNoteText = " " + TxtMessage.Text

On Error GoTo SendError
'''3 is the message_send action
MAPIMessages1.Action = 3
Exit Sub

SendError:
  gAddress = 0
  gAttach = 0
  gSend = 0
  MsgBox "Error. No mail was sent"
  Exit Sub
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -