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

📄 frmdemo.frm

📁 VB网络应用,例如:聊天系统,浏览器程序
💻 FRM
字号:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmDemo 
   Caption         =   "Sendmail with Attachments"
   ClientHeight    =   4905
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5340
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmDemo.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   4905
   ScaleWidth      =   5340
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdAbout 
      Caption         =   "About"
      Height          =   495
      Left            =   3120
      TabIndex        =   18
      Top             =   4320
      Width           =   735
   End
   Begin MSComDlg.CommonDialog cmdDialog 
      Left            =   600
      Top             =   3120
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton cmdSelect 
      Caption         =   "..."
      Height          =   255
      Left            =   4920
      TabIndex        =   16
      Top             =   1680
      Width           =   375
   End
   Begin RichTextLib.RichTextBox rtfAttach 
      Height          =   495
      Left            =   480
      TabIndex        =   15
      Top             =   4320
      Visible         =   0   'False
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   873
      _Version        =   393217
      Enabled         =   -1  'True
      TextRTF         =   $"frmDemo.frx":0442
   End
   Begin VB.CommandButton cmdSend 
      Caption         =   "Send"
      Default         =   -1  'True
      Height          =   495
      Left            =   2160
      TabIndex        =   14
      Top             =   4320
      Width           =   855
   End
   Begin VB.CommandButton cmdClose 
      Caption         =   "Close"
      Height          =   495
      Left            =   3960
      TabIndex        =   13
      Top             =   4320
      Width           =   975
   End
   Begin MSWinsockLib.Winsock Winsock1 
      Left            =   720
      Top             =   480
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
   End
   Begin VB.TextBox txtBody 
      Height          =   1335
      Left            =   2040
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   11
      Text            =   "frmDemo.frx":06B8
      Top             =   2160
      Width           =   2775
   End
   Begin VB.TextBox txtAttach 
      Height          =   285
      Left            =   2040
      TabIndex        =   8
      Text            =   "Text1"
      Top             =   1680
      Width           =   2775
   End
   Begin VB.TextBox txtSubject 
      Height          =   285
      Left            =   2040
      TabIndex        =   6
      Text            =   "Text1"
      Top             =   1320
      Width           =   2775
   End
   Begin VB.TextBox txtToAddress 
      Height          =   285
      Left            =   2040
      TabIndex        =   5
      Text            =   "Text1"
      Top             =   960
      Width           =   2775
   End
   Begin VB.TextBox txtFromAddress 
      Height          =   285
      Left            =   2040
      TabIndex        =   2
      Text            =   "Text1"
      Top             =   600
      Width           =   2775
   End
   Begin VB.TextBox txtServer 
      Height          =   285
      Left            =   2040
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   240
      Width           =   2775
   End
   Begin VB.TextBox txtOutput 
      Height          =   495
      Left            =   480
      TabIndex        =   17
      Top             =   4320
      Visible         =   0   'False
      Width           =   1695
   End
   Begin VB.Label lblStatus 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Status:"
      Height          =   255
      Left            =   480
      TabIndex        =   12
      Top             =   3840
      Width           =   4425
   End
   Begin VB.Label lblBody 
      AutoSize        =   -1  'True
      Caption         =   "Message:"
      Height          =   195
      Left            =   1080
      TabIndex        =   10
      Top             =   2040
      Width           =   690
   End
   Begin VB.Label lblAttach 
      AutoSize        =   -1  'True
      Caption         =   "Attachment file name:"
      Height          =   195
      Left            =   120
      TabIndex        =   9
      Top             =   1680
      Width           =   1590
   End
   Begin VB.Label lblSubject 
      AutoSize        =   -1  'True
      Caption         =   "Subject:"
      Height          =   195
      Left            =   1080
      TabIndex        =   7
      Top             =   1320
      Width           =   600
   End
   Begin VB.Label lblToAddress 
      AutoSize        =   -1  'True
      Caption         =   "To Address:"
      Height          =   195
      Left            =   840
      TabIndex        =   4
      Top             =   960
      Width           =   870
   End
   Begin VB.Label lblFrom 
      AutoSize        =   -1  'True
      Caption         =   "From Address:"
      Height          =   195
      Left            =   720
      TabIndex        =   3
      Top             =   600
      Width           =   1050
   End
   Begin VB.Label lblServer 
      AutoSize        =   -1  'True
      Caption         =   "POP Server:"
      Height          =   195
      Left            =   840
      TabIndex        =   1
      Top             =   240
      Width           =   885
   End
End
Attribute VB_Name = "frmDemo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'----------------------------------------
'- Name: Sam Huggill
'- Email: sam@vbsquare.com
'- Web: http;//www.vbsuare.com/
'- Company: Lighthouse Internet Solutions
'- Date/Time: 05/09/99 17:15:13
'----------------------------------------
'- Notes:   Originally written by standby@dellete.com
'           but modified by Sam Huggill
'
'           Mainly cleaned up the code for easier usage
'----------------------------------------

Option Explicit

Private Sub cmdAbout_Click()
    frmAbout.Show vbModal
End Sub

Private Sub cmdClose_Click()
    Unload Me
End Sub

Private Sub cmdSelect_Click()
        
    cmdDialog.ShowOpen
    txtAttach = cmdDialog.FileName
    
End Sub

Private Sub cmdSend_Click()
    
    cmdSend.Enabled = False
    
    If ValidateEntry = False Then MsgBox "Either the server name or to address were left empty.", vbCritical + vbOKOnly, Me.Caption: cmdSend.Enabled = True: Exit Sub
    
    If txtAttach.Text <> "" Then
        lblStatus = "Encoding file attachment"
        Base64EncodeFile txtAttach.Text, rtfAttach, txtOutput
    End If
    
    lblStatus = "Connecting to POP Server"
    ConnectToServer txtServer.Text, Winsock1
    
End Sub

Private Sub Form_Load()
    
    txtAttach = ""
    txtBody = ""
    txtFromAddress = ""
    txtServer = ""
    txtSubject = ""
    txtToAddress = ""
    
    
End Sub

Private Sub Winsock1_Connect()
    
    lblStatus = "Connected to POP Server"
    
    Wait 0.5
    
    lblStatus = "Sending mail"
    
    If txtAttach.Text = "" Then
    
        SendMail txtFromAddress, txtToAddress, txtSubject, txtBody, Winsock1
    
    Else
    
        SendMail txtFromAddress, txtToAddress, txtSubject, txtBody, Winsock1, txtAttach, txtOutput
    
    End If
    
    lblStatus = "Mail sent"
    
    cmdSend.Enabled = True
    
    lblStatus = "Status:"
    
End Sub

Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
    
    MsgBox "Error Number: " & Number & vbCrLf & Description & vbCrLf & Source, vbCritical + vbOKOnly, Me.Caption
    
End Sub

Private Function ValidateEntry() As Boolean
    
    ValidateEntry = True
    
    If txtServer.Text = "" Or txtToAddress = "" Then ValidateEntry = False
    
End Function

⌨️ 快捷键说明

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