home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1999 April / CD_Shareware_Magazine_31.iso / Free / Prg / e-checker.exe / frmConfigurar.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-08-07  |  14.3 KB  |  459 lines

  1. VERSION 5.00
  2. Begin VB.Form frmConfigurar 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Configurar e-checker"
  5.    ClientHeight    =   4920
  6.    ClientLeft      =   2565
  7.    ClientTop       =   1500
  8.    ClientWidth     =   6000
  9.    Icon            =   "frmConfigurar.frx":0000
  10.    KeyPreview      =   -1  'True
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   4920
  15.    ScaleWidth      =   6000
  16.    ShowInTaskbar   =   0   'False
  17.    StartUpPosition =   2  'CenterScreen
  18.    Begin VB.Frame Frame1 
  19.       BorderStyle     =   0  'None
  20.       Caption         =   "Frame1"
  21.       Height          =   855
  22.       Left            =   180
  23.       TabIndex        =   20
  24.       Top             =   60
  25.       Width           =   4395
  26.       Begin VB.OptionButton optBTN 
  27.          Height          =   735
  28.          Index           =   3
  29.          Left            =   2520
  30.          MaskColor       =   &H00808000&
  31.          Picture         =   "frmConfigurar.frx":000C
  32.          Style           =   1  'Graphical
  33.          TabIndex        =   27
  34.          Top             =   60
  35.          UseMaskColor    =   -1  'True
  36.          Width           =   1095
  37.       End
  38.       Begin VB.OptionButton optBTN 
  39.          Height          =   735
  40.          Index           =   2
  41.          Left            =   1260
  42.          MaskColor       =   &H00808000&
  43.          Picture         =   "frmConfigurar.frx":0C8E
  44.          Style           =   1  'Graphical
  45.          TabIndex        =   26
  46.          Top             =   60
  47.          UseMaskColor    =   -1  'True
  48.          Width           =   1095
  49.       End
  50.       Begin VB.OptionButton optBTN 
  51.          Height          =   735
  52.          Index           =   1
  53.          Left            =   0
  54.          MaskColor       =   &H00808000&
  55.          Picture         =   "frmConfigurar.frx":16C0
  56.          Style           =   1  'Graphical
  57.          TabIndex        =   25
  58.          Top             =   60
  59.          UseMaskColor    =   -1  'True
  60.          Value           =   -1  'True
  61.          Width           =   1095
  62.       End
  63.    End
  64.    Begin VB.CommandButton cmdOk 
  65.       Caption         =   "Aceptar"
  66.       Default         =   -1  'True
  67.       Height          =   435
  68.       Left            =   3480
  69.       TabIndex        =   8
  70.       Top             =   4440
  71.       Width           =   1095
  72.    End
  73.    Begin VB.CommandButton cmdCancel 
  74.       Caption         =   "Cerrar"
  75.       Height          =   435
  76.       Left            =   4740
  77.       TabIndex        =   9
  78.       Top             =   4440
  79.       Width           =   1095
  80.    End
  81.    Begin VB.Frame fraBTN 
  82.       Caption         =   "Programa E-mail"
  83.       Height          =   3375
  84.       Index           =   3
  85.       Left            =   120
  86.       TabIndex        =   17
  87.       Top             =   960
  88.       Width           =   5715
  89.       Begin VB.CommandButton cmdBrowse 
  90.          Height          =   315
  91.          Index           =   1
  92.          Left            =   4500
  93.          TabIndex        =   30
  94.          Top             =   2880
  95.          Width           =   975
  96.       End
  97.       Begin VB.TextBox txtSound 
  98.          Enabled         =   0   'False
  99.          Height          =   315
  100.          Left            =   1200
  101.          TabIndex        =   28
  102.          Top             =   2880
  103.          Width           =   2955
  104.       End
  105.       Begin VB.TextBox txtProgram 
  106.          Height          =   315
  107.          Left            =   60
  108.          TabIndex        =   5
  109.          Top             =   780
  110.          Width           =   5415
  111.       End
  112.       Begin VB.CommandButton cmdBrowse 
  113.          Height          =   315
  114.          Index           =   0
  115.          Left            =   4500
  116.          TabIndex        =   6
  117.          Top             =   1200
  118.          Width           =   975
  119.       End
  120.       Begin VB.TextBox txtArguments 
  121.          Height          =   315
  122.          Left            =   120
  123.          TabIndex        =   7
  124.          Top             =   1980
  125.          Width           =   4035
  126.       End
  127.       Begin VB.Label Label1 
  128.          Height          =   255
  129.          Index           =   11
  130.          Left            =   120
  131.          TabIndex        =   29
  132.          Top             =   2580
  133.          Width           =   4335
  134.       End
  135.       Begin VB.Label Label1 
  136.          Height          =   435
  137.          Index           =   5
  138.          Left            =   60
  139.          TabIndex        =   19
  140.          Top             =   300
  141.          Width           =   4695
  142.       End
  143.       Begin VB.Label Label1 
  144.          Height          =   255
  145.          Index           =   6
  146.          Left            =   120
  147.          TabIndex        =   18
  148.          Top             =   1680
  149.          Width           =   4155
  150.       End
  151.    End
  152.    Begin VB.Frame fraBTN 
  153.       Caption         =   "Intervalos"
  154.       Height          =   3375
  155.       Index           =   2
  156.       Left            =   120
  157.       TabIndex        =   14
  158.       Top             =   960
  159.       Width           =   5715
  160.       Begin VB.TextBox txtTimeout 
  161.          Alignment       =   1  'Right Justify
  162.          Height          =   315
  163.          Left            =   2220
  164.          MaxLength       =   2
  165.          TabIndex        =   4
  166.          Text            =   "4"
  167.          Top             =   2580
  168.          Width           =   270
  169.       End
  170.       Begin VB.TextBox txtInterval 
  171.          Alignment       =   1  'Right Justify
  172.          Height          =   315
  173.          Left            =   2220
  174.          MaxLength       =   2
  175.          TabIndex        =   3
  176.          Text            =   "3"
  177.          Top             =   1080
  178.          Width           =   270
  179.       End
  180.       Begin VB.Label Label1 
  181.          Height          =   615
  182.          Index           =   10
  183.          Left            =   300
  184.          TabIndex        =   24
  185.          Top             =   1740
  186.          Width           =   3915
  187.       End
  188.       Begin VB.Label Label1 
  189.          Height          =   195
  190.          Index           =   9
  191.          Left            =   2580
  192.          TabIndex        =   23
  193.          Top             =   2640
  194.          Width           =   795
  195.       End
  196.       Begin VB.Label Label1 
  197.          Height          =   195
  198.          Index           =   4
  199.          Left            =   1740
  200.          TabIndex        =   22
  201.          Top             =   1140
  202.          Width           =   435
  203.       End
  204.       Begin VB.Label Label1 
  205.          Height          =   675
  206.          Index           =   8
  207.          Left            =   360
  208.          TabIndex        =   16
  209.          Top             =   300
  210.          Width           =   4095
  211.       End
  212.       Begin VB.Label Label1 
  213.          Height          =   195
  214.          Index           =   7
  215.          Left            =   2580
  216.          TabIndex        =   15
  217.          Top             =   1140
  218.          Width           =   615
  219.       End
  220.    End
  221.    Begin VB.Frame fraBTN 
  222.       Height          =   3375
  223.       Index           =   1
  224.       Left            =   120
  225.       TabIndex        =   10
  226.       Top             =   960
  227.       Width           =   5715
  228.       Begin VB.TextBox txtPop3Host 
  229.          Height          =   315
  230.          Left            =   2580
  231.          TabIndex        =   0
  232.          Top             =   1260
  233.          Width           =   2355
  234.       End
  235.       Begin VB.TextBox txtPop3User 
  236.          Height          =   315
  237.          Left            =   2580
  238.          MaxLength       =   30
  239.          TabIndex        =   1
  240.          Top             =   1860
  241.          Width           =   2055
  242.       End
  243.       Begin VB.TextBox txtPop3Passwd 
  244.          Height          =   315
  245.          IMEMode         =   3  'DISABLE
  246.          Left            =   2580
  247.          MaxLength       =   20
  248.          PasswordChar    =   "*"
  249.          TabIndex        =   2
  250.          Top             =   2460
  251.          Width           =   1995
  252.       End
  253.       Begin VB.Label Label1 
  254.          Height          =   495
  255.          Index           =   3
  256.          Left            =   300
  257.          TabIndex        =   21
  258.          Top             =   420
  259.          Width           =   4635
  260.       End
  261.       Begin VB.Label Label1 
  262.          Height          =   375
  263.          Index           =   0
  264.          Left            =   360
  265.          TabIndex        =   13
  266.          Top             =   1200
  267.          Width           =   2235
  268.       End
  269.       Begin VB.Label Label1 
  270.          Height          =   195
  271.          Index           =   1
  272.          Left            =   360
  273.          TabIndex        =   12
  274.          Top             =   1860
  275.          Width           =   1935
  276.       End
  277.       Begin VB.Label Label1 
  278.          Height          =   195
  279.          Index           =   2
  280.          Left            =   360
  281.          TabIndex        =   11
  282.          Top             =   2520
  283.          Width           =   1635
  284.       End
  285.    End
  286. Attribute VB_Name = "frmConfigurar"
  287. Attribute VB_GlobalNameSpace = False
  288. Attribute VB_Creatable = False
  289. Attribute VB_PredeclaredId = True
  290. Attribute VB_Exposed = False
  291. 'Configure e-checker
  292. Option Explicit
  293. 'Read the apropiate labels for the resource file
  294. Private Sub ConfigLabels()
  295.     Dim i As Integer
  296.     Me.Caption = LoadResString(Language + 40) + " E-checker"
  297.     For i = 41 To 43
  298.         fraBTN(i - 40).Caption = LoadResString(Language + i)
  299.         optBTN(i - 40).Caption = LoadResString(Language + i + 3)
  300.     Next
  301.     cmdOk.Caption = LoadResString(Language + 2)
  302.     cmdCancel.Caption = LoadResString(Language + 47)
  303.     For i = 48 To 59
  304.         Label1(i - 48).Caption = LoadResString(Language + i)
  305.     Next
  306.     cmdBrowse(0).Caption = LoadResString(Language + 69)
  307.     cmdBrowse(1).Caption = LoadResString(Language + 69)
  308. End Sub
  309. 'Read program settings
  310. Private Sub LeerSeteos()
  311.     txtPop3Host = pop3Host
  312.     txtPop3User = pop3User
  313.     txtPop3Passwd = pop3Passwd
  314.     txtInterval = Interval
  315.     txtProgram = EmailProgram
  316.     txtArguments = Arguments
  317.     txtTimeout = Timeout
  318.     txtSound = Sound
  319. End Sub
  320. 'Save the settings
  321. Private Sub GuardarSeteos()
  322.     pop3Host = txtPop3Host
  323.     pop3User = txtPop3User
  324.     pop3Passwd = txtPop3Passwd
  325.     Interval = txtInterval
  326.     EmailProgram = txtProgram
  327.     Arguments = txtArguments
  328.     Timeout = txtTimeout
  329.     Sound = txtSound
  330.     SaveSetting App.EXEName, "Config", "Host", pop3Host
  331.     SaveSetting App.EXEName, "Config", "User", pop3User
  332.     SaveSetting App.EXEName, "Config", "Passwd", pop3Passwd
  333.     SaveSetting App.EXEName, "Config", "Interval", Interval
  334.     SaveSetting App.EXEName, "Config", "Program", EmailProgram
  335.     SaveSetting App.EXEName, "Config", "Arguments", Arguments
  336.     SaveSetting App.EXEName, "Config", "Timeout", Timeout
  337.     SaveSetting App.EXEName, "Config", "Sound", Sound
  338. End Sub
  339. 'Check field completeness
  340. Private Function TodoOk() As Boolean
  341.         
  342.     'POP3 Host
  343.     If txtPop3Host = "" Then
  344.         MsgBox LoadResString(Language + 70), vbExclamation
  345.         txtPop3Host.SetFocus
  346.         fraBTN(1).Visible = True
  347.         fraBTN(1).ZOrder (0)
  348.         Exit Function
  349.     End If
  350.     'POP3 User
  351.     If txtPop3User = "" Then
  352.         MsgBox LoadResString(Language + 71), vbExclamation
  353.         txtPop3User.SetFocus
  354.         fraBTN(1).Visible = True
  355.         fraBTN(1).ZOrder (0)
  356.         Exit Function
  357.     End If
  358.     'No password check
  359.     'Check interval
  360.     If Val(txtInterval) = 0 Then
  361.         MsgBox LoadResString(Language + 72), vbExclamation
  362.         txtInterval.SetFocus
  363.         fraBTN(2).Visible = True
  364.         fraBTN(2).ZOrder (0)
  365.         Exit Function
  366.     End If
  367.     'Check timeout
  368.     If Val(txtTimeout) = 0 Then
  369.         MsgBox LoadResString(Language + 73), vbExclamation
  370.         txtTimeout.SetFocus
  371.         fraBTN(2).Visible = True
  372.         fraBTN(2).ZOrder (0)
  373.         Exit Function
  374.     End If
  375.     TodoOk = True
  376. End Function
  377. 'Browse button
  378. Private Sub cmdBrowse_Click(Index As Integer)
  379.     Dim ofn As OPENFILENAME
  380.     Dim rtn As String
  381.     ofn.lStructSize = Len(ofn)
  382.     ofn.hwndOwner = Me.hwnd
  383.     ofn.hInstance = App.hInstance
  384.     ofn.flags = OFNFileMustExist + OFNHideReadOnly + OFNPathMustExist
  385.     'Browse for e-mail program
  386.     If Index = 0 Then
  387.         ofn.lpstrFilter = LoadResString(Language + 74) + Chr(0)
  388.         ofn.lpstrFile = Space(254) + Chr(0)
  389.         ofn.nMaxFile = 255
  390.         ofn.lpstrFileTitle = Space(254) + Chr(0)
  391.         ofn.nMaxFileTitle = 255
  392.         ofn.lpstrInitialDir = "c:\" + Chr(0)
  393.         ofn.lpstrTitle = LoadResString(Language + 75) + Chr(0)
  394.         rtn = GetOpenFileName(ofn)
  395.         
  396.         If rtn >= 1 Then
  397.            txtProgram.Text = ofn.lpstrFile
  398.         End If
  399.     Else  'browse for sound
  400.         ofn.lpstrFilter = LoadResString(Language + 76) + Chr(0) + "*.wav" + Chr(0)
  401.         ofn.lpstrFile = Space(254) + Chr(0)
  402.         ofn.nMaxFile = 255
  403.         ofn.lpstrFileTitle = Space(254) + Chr(0)
  404.         ofn.nMaxFileTitle = 255
  405.         ofn.lpstrInitialDir = App.Path + Chr(0)
  406.         ofn.lpstrTitle = LoadResString(Language + 77) + Chr(0)
  407.         rtn = GetOpenFileName(ofn)
  408.         
  409.         If rtn >= 1 Then
  410.            txtSound.Text = ofn.lpstrFile
  411.         End If
  412.     End If
  413. End Sub
  414. Private Sub cmdCancel_Click()
  415.     Unload Me
  416. End Sub
  417. Private Sub cmdOK_Click()
  418.     If TodoOk() Then
  419.         GuardarSeteos
  420.         Unload Me
  421.     End If
  422. End Sub
  423. 'Activates the corresponding frame
  424. Private Sub optBTN_Click(Index As Integer)
  425.     Dim i As Integer
  426.     fraBTN(Index).Visible = True
  427.     For i = 1 To 3
  428.         If i <> Index Then fraBTN(i).Visible = False
  429.     Next
  430.     Select Case Index
  431.         Case 1
  432.             txtPop3Host.SetFocus
  433.         Case 2
  434.             txtInterval.SetFocus
  435.         Case 3
  436.             txtProgram.SetFocus
  437.     End Select
  438. End Sub
  439. Private Sub Form_Load()
  440.     Dim i As Integer
  441.     ConfigLabels
  442.     cmdBrowse(1).Enabled = HasSound()
  443.     txtSound.Enabled = HasSound
  444.     Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
  445.     LeerSeteos
  446.     fraBTN(1).Visible = True
  447.     fraBTN(1).ZOrder (0)
  448. End Sub
  449. Private Sub txtInterval_KeyPress(KeyAscii As Integer)
  450.     If (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And KeyAscii <> vbKeyBack Then
  451.         KeyAscii = 0
  452.     End If
  453. End Sub
  454. Private Sub txtTimeout_KeyPress(KeyAscii As Integer)
  455.     If (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And KeyAscii <> vbKeyBack Then
  456.         KeyAscii = 0
  457.     End If
  458. End Sub
  459.