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

📄 frmconfigurar.frm

📁 使用Winsock控制检测是否有邮件邮件服务器必须支持POP3
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmConfigurar 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Configurar e-checker"
   ClientHeight    =   4920
   ClientLeft      =   2565
   ClientTop       =   1500
   ClientWidth     =   6000
   Icon            =   "frmConfigurar.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4920
   ScaleWidth      =   6000
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame Frame1 
      BorderStyle     =   0  'None
      Caption         =   "Frame1"
      Height          =   855
      Left            =   180
      TabIndex        =   20
      Top             =   60
      Width           =   4395
      Begin VB.OptionButton optBTN 
         Height          =   735
         Index           =   3
         Left            =   2520
         MaskColor       =   &H00808000&
         Picture         =   "frmConfigurar.frx":000C
         Style           =   1  'Graphical
         TabIndex        =   27
         Top             =   60
         UseMaskColor    =   -1  'True
         Width           =   1095
      End
      Begin VB.OptionButton optBTN 
         Height          =   735
         Index           =   2
         Left            =   1260
         MaskColor       =   &H00808000&
         Picture         =   "frmConfigurar.frx":0C8E
         Style           =   1  'Graphical
         TabIndex        =   26
         Top             =   60
         UseMaskColor    =   -1  'True
         Width           =   1095
      End
      Begin VB.OptionButton optBTN 
         Height          =   735
         Index           =   1
         Left            =   0
         MaskColor       =   &H00808000&
         Picture         =   "frmConfigurar.frx":16C0
         Style           =   1  'Graphical
         TabIndex        =   25
         Top             =   60
         UseMaskColor    =   -1  'True
         Value           =   -1  'True
         Width           =   1095
      End
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "Aceptar"
      Default         =   -1  'True
      Height          =   435
      Left            =   3480
      TabIndex        =   8
      Top             =   4440
      Width           =   1095
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "Cerrar"
      Height          =   435
      Left            =   4740
      TabIndex        =   9
      Top             =   4440
      Width           =   1095
   End
   Begin VB.Frame fraBTN 
      Caption         =   "Programa E-mail"
      Height          =   3375
      Index           =   3
      Left            =   120
      TabIndex        =   17
      Top             =   960
      Width           =   5715
      Begin VB.CommandButton cmdBrowse 
         Height          =   315
         Index           =   1
         Left            =   4500
         TabIndex        =   30
         Top             =   2880
         Width           =   975
      End
      Begin VB.TextBox txtSound 
         Enabled         =   0   'False
         Height          =   315
         Left            =   1200
         TabIndex        =   28
         Top             =   2880
         Width           =   2955
      End
      Begin VB.TextBox txtProgram 
         Height          =   315
         Left            =   60
         TabIndex        =   5
         Top             =   780
         Width           =   5415
      End
      Begin VB.CommandButton cmdBrowse 
         Height          =   315
         Index           =   0
         Left            =   4500
         TabIndex        =   6
         Top             =   1200
         Width           =   975
      End
      Begin VB.TextBox txtArguments 
         Height          =   315
         Left            =   120
         TabIndex        =   7
         Top             =   1980
         Width           =   4035
      End
      Begin VB.Label Label1 
         Height          =   255
         Index           =   11
         Left            =   120
         TabIndex        =   29
         Top             =   2580
         Width           =   4335
      End
      Begin VB.Label Label1 
         Height          =   435
         Index           =   5
         Left            =   60
         TabIndex        =   19
         Top             =   300
         Width           =   4695
      End
      Begin VB.Label Label1 
         Height          =   255
         Index           =   6
         Left            =   120
         TabIndex        =   18
         Top             =   1680
         Width           =   4155
      End
   End
   Begin VB.Frame fraBTN 
      Caption         =   "Intervalos"
      Height          =   3375
      Index           =   2
      Left            =   120
      TabIndex        =   14
      Top             =   960
      Width           =   5715
      Begin VB.TextBox txtTimeout 
         Alignment       =   1  'Right Justify
         Height          =   315
         Left            =   2220
         MaxLength       =   2
         TabIndex        =   4
         Text            =   "4"
         Top             =   2580
         Width           =   270
      End
      Begin VB.TextBox txtInterval 
         Alignment       =   1  'Right Justify
         Height          =   315
         Left            =   2220
         MaxLength       =   2
         TabIndex        =   3
         Text            =   "3"
         Top             =   1080
         Width           =   270
      End
      Begin VB.Label Label1 
         Height          =   615
         Index           =   10
         Left            =   300
         TabIndex        =   24
         Top             =   1740
         Width           =   3915
      End
      Begin VB.Label Label1 
         Height          =   195
         Index           =   9
         Left            =   2580
         TabIndex        =   23
         Top             =   2640
         Width           =   795
      End
      Begin VB.Label Label1 
         Height          =   195
         Index           =   4
         Left            =   1740
         TabIndex        =   22
         Top             =   1140
         Width           =   435
      End
      Begin VB.Label Label1 
         Height          =   675
         Index           =   8
         Left            =   360
         TabIndex        =   16
         Top             =   300
         Width           =   4095
      End
      Begin VB.Label Label1 
         Height          =   195
         Index           =   7
         Left            =   2580
         TabIndex        =   15
         Top             =   1140
         Width           =   615
      End
   End
   Begin VB.Frame fraBTN 
      Height          =   3375
      Index           =   1
      Left            =   120
      TabIndex        =   10
      Top             =   960
      Width           =   5715
      Begin VB.TextBox txtPop3Host 
         Height          =   315
         Left            =   2580
         TabIndex        =   0
         Top             =   1260
         Width           =   2355
      End
      Begin VB.TextBox txtPop3User 
         Height          =   315
         Left            =   2580
         MaxLength       =   30
         TabIndex        =   1
         Top             =   1860
         Width           =   2055
      End
      Begin VB.TextBox txtPop3Passwd 
         Height          =   315
         IMEMode         =   3  'DISABLE
         Left            =   2580
         MaxLength       =   20
         PasswordChar    =   "*"
         TabIndex        =   2
         Top             =   2460
         Width           =   1995
      End
      Begin VB.Label Label1 
         Height          =   495
         Index           =   3
         Left            =   300
         TabIndex        =   21
         Top             =   420
         Width           =   4635
      End
      Begin VB.Label Label1 
         Height          =   375
         Index           =   0
         Left            =   360
         TabIndex        =   13
         Top             =   1200
         Width           =   2235
      End
      Begin VB.Label Label1 
         Height          =   195
         Index           =   1
         Left            =   360
         TabIndex        =   12
         Top             =   1860
         Width           =   1935
      End
      Begin VB.Label Label1 
         Height          =   195
         Index           =   2
         Left            =   360
         TabIndex        =   11
         Top             =   2520
         Width           =   1635
      End
   End
End
Attribute VB_Name = "frmConfigurar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Configure e-checker

Option Explicit

'Read the apropiate labels for the resource file
Private Sub ConfigLabels()
    Dim i As Integer
    
    Me.Caption = LoadResString(Language + 40) + " E-checker"
    For i = 41 To 43
        fraBTN(i - 40).Caption = LoadResString(Language + i)
        optBTN(i - 40).Caption = LoadResString(Language + i + 3)
    Next
    cmdOk.Caption = LoadResString(Language + 2)
    cmdCancel.Caption = LoadResString(Language + 47)
    For i = 48 To 59
        Label1(i - 48).Caption = LoadResString(Language + i)
    Next
    cmdBrowse(0).Caption = LoadResString(Language + 69)
    cmdBrowse(1).Caption = LoadResString(Language + 69)
End Sub

'Read program settings
Private Sub LeerSeteos()
    txtPop3Host = pop3Host
    txtPop3User = pop3User
    txtPop3Passwd = pop3Passwd
    txtInterval = Interval
    txtProgram = EmailProgram
    txtArguments = Arguments
    txtTimeout = Timeout
    txtSound = Sound
End Sub
'Save the settings
Private Sub GuardarSeteos()
    pop3Host = txtPop3Host
    pop3User = txtPop3User
    pop3Passwd = txtPop3Passwd
    Interval = txtInterval
    EmailProgram = txtProgram
    Arguments = txtArguments
    Timeout = txtTimeout
    Sound = txtSound
    SaveSetting App.EXEName, "Config", "Host", pop3Host
    SaveSetting App.EXEName, "Config", "User", pop3User
    SaveSetting App.EXEName, "Config", "Passwd", pop3Passwd
    SaveSetting App.EXEName, "Config", "Interval", Interval
    SaveSetting App.EXEName, "Config", "Program", EmailProgram
    SaveSetting App.EXEName, "Config", "Arguments", Arguments
    SaveSetting App.EXEName, "Config", "Timeout", Timeout
    SaveSetting App.EXEName, "Config", "Sound", Sound
End Sub
'Check field completeness
Private Function TodoOk() As Boolean
        
    'POP3 Host
    If txtPop3Host = "" Then
        MsgBox LoadResString(Language + 70), vbExclamation
        txtPop3Host.SetFocus
        fraBTN(1).Visible = True
        fraBTN(1).ZOrder (0)
        Exit Function
    End If
    'POP3 User
    If txtPop3User = "" Then
        MsgBox LoadResString(Language + 71), vbExclamation
        txtPop3User.SetFocus
        fraBTN(1).Visible = True
        fraBTN(1).ZOrder (0)
        Exit Function
    End If
    'No password check
    'Check interval
    If Val(txtInterval) = 0 Then
        MsgBox LoadResString(Language + 72), vbExclamation
        txtInterval.SetFocus
        fraBTN(2).Visible = True
        fraBTN(2).ZOrder (0)
        Exit Function
    End If
    'Check timeout
    If Val(txtTimeout) = 0 Then
        MsgBox LoadResString(Language + 73), vbExclamation
        txtTimeout.SetFocus
        fraBTN(2).Visible = True
        fraBTN(2).ZOrder (0)
        Exit Function
    End If
    
    TodoOk = True
End Function
'Browse button
Private Sub cmdBrowse_Click(Index As Integer)
    Dim ofn As OPENFILENAME
    Dim rtn As String
    
    ofn.lStructSize = Len(ofn)
    ofn.hwndOwner = Me.hwnd
    ofn.hInstance = App.hInstance
    ofn.flags = OFNFileMustExist + OFNHideReadOnly + OFNPathMustExist
    
    'Browse for e-mail program
    If Index = 0 Then
    
        ofn.lpstrFilter = LoadResString(Language + 74) + Chr(0)
        ofn.lpstrFile = Space(254) + Chr(0)
        ofn.nMaxFile = 255
        ofn.lpstrFileTitle = Space(254) + Chr(0)
        ofn.nMaxFileTitle = 255
        ofn.lpstrInitialDir = "c:\" + Chr(0)
        ofn.lpstrTitle = LoadResString(Language + 75) + Chr(0)

        rtn = GetOpenFileName(ofn)
        
        If rtn >= 1 Then
           txtProgram.Text = ofn.lpstrFile
        End If
    
    Else  'browse for sound
    
        ofn.lpstrFilter = LoadResString(Language + 76) + Chr(0) + "*.wav" + Chr(0)
        ofn.lpstrFile = Space(254) + Chr(0)
        ofn.nMaxFile = 255
        ofn.lpstrFileTitle = Space(254) + Chr(0)
        ofn.nMaxFileTitle = 255
        ofn.lpstrInitialDir = App.Path + Chr(0)
        ofn.lpstrTitle = LoadResString(Language + 77) + Chr(0)
        rtn = GetOpenFileName(ofn)
        
        If rtn >= 1 Then
           txtSound.Text = ofn.lpstrFile
        End If
    End If
    
End Sub

Private Sub cmdCancel_Click()
    Unload Me
End Sub


Private Sub cmdOK_Click()

    If TodoOk() Then
        GuardarSeteos
        Unload Me
    End If
    
End Sub
'Activates the corresponding frame
Private Sub optBTN_Click(Index As Integer)
    Dim i As Integer
    
    fraBTN(Index).Visible = True
    For i = 1 To 3
        If i <> Index Then fraBTN(i).Visible = False
    Next
    Select Case Index
        Case 1
            txtPop3Host.SetFocus
        Case 2
            txtInterval.SetFocus
        Case 3
            txtProgram.SetFocus
    End Select
    
End Sub
Private Sub Form_Load()
    Dim i As Integer
    
    ConfigLabels
    cmdBrowse(1).Enabled = HasSound()
    txtSound.Enabled = HasSound
    
    Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
    LeerSeteos
    fraBTN(1).Visible = True
    fraBTN(1).ZOrder (0)
End Sub
Private Sub txtInterval_KeyPress(KeyAscii As Integer)

    If (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And KeyAscii <> vbKeyBack Then
        KeyAscii = 0
    End If
    
End Sub

Private Sub txtTimeout_KeyPress(KeyAscii As Integer)
    
    If (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And KeyAscii <> vbKeyBack Then
        KeyAscii = 0
    End If
    
End Sub

⌨️ 快捷键说明

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