home *** CD-ROM | disk | FTP | other *** search
/ PC to Maximum / PC-na-maximum.bin / DriveSpeed / SRC / DRSPCC / DRSPCC.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-06-04  |  37.0 KB  |  1,108 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    ClientHeight    =   5790
  6.    ClientLeft      =   1665
  7.    ClientTop       =   2055
  8.    ClientWidth     =   6975
  9.    Height          =   6165
  10.    Icon            =   DRSPCC.FRX:0000
  11.    Left            =   1620
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   386
  15.    ScaleMode       =   3  'Pixel
  16.    ScaleWidth      =   465
  17.    Top             =   1725
  18.    Width           =   7065
  19.    Begin CommandButton View 
  20.       Caption         =   "Sho&w log-file"
  21.       Height          =   315
  22.       Left            =   3240
  23.       TabIndex        =   45
  24.       Top             =   3270
  25.       Width           =   1335
  26.    End
  27.    Begin CommandButton Stop_t 
  28.       Caption         =   "S&top"
  29.       Enabled         =   0   'False
  30.       Height          =   375
  31.       Left            =   2640
  32.       TabIndex        =   47
  33.       Top             =   5280
  34.       Width           =   1695
  35.    End
  36.    Begin Frame Parameters 
  37.       BackColor       =   &H00C0C0C0&
  38.       Caption         =   "Parameters"
  39.       Height          =   1935
  40.       Left            =   1920
  41.       TabIndex        =   53
  42.       Top             =   1320
  43.       Width           =   4815
  44.       Begin VScrollBar TScroll 
  45.          Height          =   285
  46.          Left            =   2400
  47.          Max             =   3
  48.          Min             =   999
  49.          TabIndex        =   55
  50.          TabStop         =   0   'False
  51.          Top             =   720
  52.          Value           =   3
  53.          Width           =   255
  54.       End
  55.       Begin VScrollBar SScroll 
  56.          Height          =   285
  57.          Left            =   2400
  58.          Max             =   1
  59.          Min             =   999
  60.          TabIndex        =   54
  61.          TabStop         =   0   'False
  62.          Tag             =   "5"
  63.          Top             =   360
  64.          Value           =   5
  65.          Width           =   255
  66.       End
  67.       Begin CommandButton Batch_Help 
  68.          Caption         =   " ?"
  69.          Height          =   255
  70.          Left            =   3360
  71.          TabIndex        =   44
  72.          Top             =   720
  73.          Width           =   255
  74.       End
  75.       Begin CommandButton Log_Help 
  76.          Caption         =   " ?"
  77.          Height          =   255
  78.          Left            =   2760
  79.          TabIndex        =   43
  80.          Top             =   1080
  81.          Width           =   255
  82.       End
  83.       Begin CommandButton Turns_Help 
  84.          Caption         =   " ?"
  85.          Height          =   255
  86.          Left            =   2760
  87.          TabIndex        =   42
  88.          Top             =   720
  89.          Width           =   255
  90.       End
  91.       Begin CommandButton Size_Help 
  92.          Caption         =   " ?"
  93.          Height          =   255
  94.          Left            =   2760
  95.          TabIndex        =   41
  96.          Top             =   360
  97.          Width           =   255
  98.       End
  99.       Begin CheckBox Batch 
  100.          BackColor       =   &H00C0C0C0&
  101.          Caption         =   "&Batch mode"
  102.          Height          =   255
  103.          Left            =   3360
  104.          TabIndex        =   40
  105.          Top             =   360
  106.          Width           =   1335
  107.       End
  108.       Begin TextBox Size 
  109.          Alignment       =   1  'Right Justify
  110.          Height          =   285
  111.          Left            =   1680
  112.          MaxLength       =   6
  113.          TabIndex        =   34
  114.          Text            =   "1"
  115.          Top             =   360
  116.          Width           =   735
  117.       End
  118.       Begin TextBox Turns 
  119.          Alignment       =   1  'Right Justify
  120.          Height          =   285
  121.          Left            =   1680
  122.          MaxLength       =   3
  123.          TabIndex        =   36
  124.          Text            =   "3"
  125.          Top             =   720
  126.          Width           =   735
  127.       End
  128.       Begin TextBox Log_f 
  129.          Height          =   285
  130.          Left            =   120
  131.          MaxLength       =   80
  132.          TabIndex        =   39
  133.          Top             =   1440
  134.          Width           =   4575
  135.       End
  136.       Begin CommandButton Log_sel 
  137.          Caption         =   "Se&lect"
  138.          Height          =   278
  139.          Left            =   1680
  140.          TabIndex        =   38
  141.          Top             =   1080
  142.          Width           =   975
  143.       End
  144.       Begin Line Line3 
  145.          X1              =   3195
  146.          X2              =   3195
  147.          Y1              =   300
  148.          Y2              =   1340
  149.       End
  150.       Begin Label Label2 
  151.          BackColor       =   &H00FFFFFF&
  152.          BackStyle       =   0  'Transparent
  153.          Caption         =   "Test-file s&ize:"
  154.          Height          =   255
  155.          Left            =   120
  156.          TabIndex        =   33
  157.          Top             =   360
  158.          Width           =   1215
  159.       End
  160.       Begin Label Turn_lbl 
  161.          BackColor       =   &H00FFFFFF&
  162.          BackStyle       =   0  'Transparent
  163.          Caption         =   "Number of &turns:"
  164.          Height          =   255
  165.          Left            =   120
  166.          TabIndex        =   35
  167.          Top             =   720
  168.          Width           =   1455
  169.       End
  170.       Begin Label Label4 
  171.          BackColor       =   &H00FFFFFF&
  172.          BackStyle       =   0  'Transparent
  173.          Caption         =   "&Log-file to use:"
  174.          Height          =   255
  175.          Left            =   120
  176.          TabIndex        =   37
  177.          Top             =   1080
  178.          Width           =   1455
  179.       End
  180.    End
  181.    Begin TextBox Status 
  182.       Height          =   1335
  183.       Left            =   1920
  184.       MultiLine       =   -1  'True
  185.       ScrollBars      =   3  'Both
  186.       TabIndex        =   52
  187.       TabStop         =   0   'False
  188.       Top             =   3600
  189.       Width           =   4815
  190.    End
  191.    Begin CommandButton Quit 
  192.       Caption         =   "&Quit"
  193.       Height          =   375
  194.       Left            =   4920
  195.       TabIndex        =   48
  196.       Top             =   5280
  197.       Width           =   1695
  198.    End
  199.    Begin CommandButton Drsp_do 
  200.       Caption         =   "R&un test(s)"
  201.       Height          =   375
  202.       Left            =   360
  203.       TabIndex        =   46
  204.       Top             =   5280
  205.       Width           =   1695
  206.    End
  207.    Begin Frame RO 
  208.       BackColor       =   &H00C0C0C0&
  209.       Height          =   1095
  210.       Left            =   1920
  211.       TabIndex        =   49
  212.       Top             =   120
  213.       Width           =   2295
  214.       Begin CommandButton RO_Help 
  215.          Caption         =   " ?"
  216.          Height          =   255
  217.          Left            =   1920
  218.          TabIndex        =   32
  219.          Top             =   240
  220.          Width           =   255
  221.       End
  222.       Begin OptionButton RSW 
  223.          BackColor       =   &H00C0C0C0&
  224.          Caption         =   "&Multi-pass"
  225.          Enabled         =   0   'False
  226.          Height          =   255
  227.          Index           =   1
  228.          Left            =   120
  229.          TabIndex        =   31
  230.          Top             =   720
  231.          Width           =   1695
  232.       End
  233.       Begin OptionButton RSW 
  234.          BackColor       =   &H00C0C0C0&
  235.          Caption         =   "&Single-pass"
  236.          Enabled         =   0   'False
  237.          Height          =   255
  238.          Index           =   0
  239.          Left            =   120
  240.          TabIndex        =   30
  241.          Top             =   360
  242.          Value           =   -1  'True
  243.          Width           =   1695
  244.       End
  245.       Begin CheckBox RO_tgl 
  246.          BackColor       =   &H00C0C0C0&
  247.          Caption         =   "&Read-only mode"
  248.          Height          =   255
  249.          Left            =   120
  250.          TabIndex        =   29
  251.          Top             =   0
  252.          Width           =   1695
  253.       End
  254.    End
  255.    Begin Frame Drives 
  256.       BackColor       =   &H00C0C0C0&
  257.       Caption         =   "Drives"
  258.       Height          =   4815
  259.       Left            =   240
  260.       TabIndex        =   0
  261.       Top             =   120
  262.       Width           =   1455
  263.       Begin CommandButton Drv_Help 
  264.          Caption         =   " ?"
  265.          Height          =   255
  266.          Left            =   600
  267.          TabIndex        =   28
  268.          Top             =   360
  269.          Width           =   255
  270.       End
  271.       Begin CheckBox Drv_all 
  272.          BackColor       =   &H00C0C0C0&
  273.          Caption         =   "Select &all"
  274.          Height          =   255
  275.          Left            =   120
  276.          TabIndex        =   27
  277.          Top             =   4320
  278.          Width           =   1215
  279.       End
  280.       Begin CheckBox Drv 
  281.          BackColor       =   &H00C0C0C0&
  282.          Caption         =   "Z:"
  283.          Enabled         =   0   'False
  284.          Height          =   255
  285.          Index           =   25
  286.          Left            =   840
  287.          TabIndex        =   26
  288.          Top             =   3840
  289.          Width           =   495
  290.       End
  291.       Begin CheckBox Drv 
  292.          BackColor       =   &H00C0C0C0&
  293.          Caption         =   "Y:"
  294.          Enabled         =   0   'False
  295.          Height          =   255
  296.          Index           =   24
  297.          Left            =   840
  298.          TabIndex        =   25
  299.          Top             =   3600
  300.          Width           =   495
  301.       End
  302.       Begin CheckBox Drv 
  303.          BackColor       =   &H00C0C0C0&
  304.          Caption         =   "X:"
  305.          Enabled         =   0   'False
  306.          Height          =   255
  307.          Index           =   23
  308.          Left            =   840
  309.          TabIndex        =   24
  310.          Top             =   3360
  311.          Width           =   495
  312.       End
  313.       Begin CheckBox Drv 
  314.          BackColor       =   &H00C0C0C0&
  315.          Caption         =   "W:"
  316.          Enabled         =   0   'False
  317.          Height          =   255
  318.          Index           =   22
  319.          Left            =   840
  320.          TabIndex        =   23
  321.          Top             =   3120
  322.          Width           =   495
  323.       End
  324.       Begin CheckBox Drv 
  325.          BackColor       =   &H00C0C0C0&
  326.          Caption         =   "V:"
  327.          Enabled         =   0   'False
  328.          Height          =   255
  329.          Index           =   21
  330.          Left            =   840
  331.          TabIndex        =   22
  332.          Top             =   2880
  333.          Width           =   495
  334.       End
  335.       Begin CheckBox Drv 
  336.          BackColor       =   &H00C0C0C0&
  337.          Caption         =   "U:"
  338.          Enabled         =   0   'False
  339.          Height          =   255
  340.          Index           =   20
  341.          Left            =   840
  342.          TabIndex        =   21
  343.          Top             =   2640
  344.          Width           =   495
  345.       End
  346.       Begin CheckBox Drv 
  347.          BackColor       =   &H00C0C0C0&
  348.          Caption         =   "T:"
  349.          Enabled         =   0   'False
  350.          Height          =   255
  351.          Index           =   19
  352.          Left            =   840
  353.          TabIndex        =   20
  354.          Top             =   2400
  355.          Width           =   495
  356.       End
  357.       Begin CheckBox Drv 
  358.          BackColor       =   &H00C0C0C0&
  359.          Caption         =   "S:"
  360.          Enabled         =   0   'False
  361.          Height          =   255
  362.          Index           =   18
  363.          Left            =   840
  364.          TabIndex        =   19
  365.          Top             =   2160
  366.          Width           =   495
  367.       End
  368.       Begin CheckBox Drv 
  369.          BackColor       =   &H00C0C0C0&
  370.          Caption         =   "R:"
  371.          Enabled         =   0   'False
  372.          Height          =   255
  373.          Index           =   17
  374.          Left            =   840
  375.          TabIndex        =   18
  376.          Top             =   1920
  377.          Width           =   495
  378.       End
  379.       Begin CheckBox Drv 
  380.          BackColor       =   &H00C0C0C0&
  381.          Caption         =   "Q:"
  382.          Enabled         =   0   'False
  383.          Height          =   255
  384.          Index           =   16
  385.          Left            =   840
  386.          TabIndex        =   17
  387.          Top             =   1680
  388.          Width           =   495
  389.       End
  390.       Begin CheckBox Drv 
  391.          BackColor       =   &H00C0C0C0&
  392.          Caption         =   "P:"
  393.          Enabled         =   0   'False
  394.          Height          =   255
  395.          Index           =   15
  396.          Left            =   840
  397.          TabIndex        =   16
  398.          Top             =   1440
  399.          Width           =   495
  400.       End
  401.       Begin CheckBox Drv 
  402.          BackColor       =   &H00C0C0C0&
  403.          Caption         =   "O:"
  404.          Enabled         =   0   'False
  405.          Height          =   255
  406.          Index           =   14
  407.          Left            =   840
  408.          TabIndex        =   15
  409.          Top             =   1200
  410.          Width           =   495
  411.       End
  412.       Begin CheckBox Drv 
  413.          BackColor       =   &H00C0C0C0&
  414.          Caption         =   "N:"
  415.          Enabled         =   0   'False
  416.          Height          =   255
  417.          Index           =   13
  418.          Left            =   840
  419.          TabIndex        =   14
  420.          Top             =   960
  421.          Width           =   495
  422.       End
  423.       Begin CheckBox Drv 
  424.          BackColor       =   &H00C0C0C0&
  425.          Caption         =   "M:"
  426.          Enabled         =   0   'False
  427.          Height          =   255
  428.          Index           =   12
  429.          Left            =   120
  430.          TabIndex        =   13
  431.          Top             =   3840
  432.          Width           =   495
  433.       End
  434.       Begin CheckBox Drv 
  435.          BackColor       =   &H00C0C0C0&
  436.          Caption         =   "L:"
  437.          Enabled         =   0   'False
  438.          Height          =   255
  439.          Index           =   11
  440.          Left            =   120
  441.          TabIndex        =   12
  442.          Top             =   3600
  443.          Width           =   495
  444.       End
  445.       Begin CheckBox Drv 
  446.          BackColor       =   &H00C0C0C0&
  447.          Caption         =   "K:"
  448.          Enabled         =   0   'False
  449.          Height          =   255
  450.          Index           =   10
  451.          Left            =   120
  452.          TabIndex        =   11
  453.          Top             =   3360
  454.          Width           =   495
  455.       End
  456.       Begin CheckBox Drv 
  457.          BackColor       =   &H00C0C0C0&
  458.          Caption         =   "J:"
  459.          Enabled         =   0   'False
  460.          Height          =   255
  461.          Index           =   9
  462.          Left            =   120
  463.          TabIndex        =   10
  464.          Top             =   3120
  465.          Width           =   495
  466.       End
  467.       Begin CheckBox Drv 
  468.          BackColor       =   &H00C0C0C0&
  469.          Caption         =   "I:"
  470.          Enabled         =   0   'False
  471.          Height          =   255
  472.          Index           =   8
  473.          Left            =   120
  474.          TabIndex        =   9
  475.          Top             =   2880
  476.          Width           =   495
  477.       End
  478.       Begin CheckBox Drv 
  479.          BackColor       =   &H00C0C0C0&
  480.          Caption         =   "H:"
  481.          Enabled         =   0   'False
  482.          Height          =   255
  483.          Index           =   7
  484.          Left            =   120
  485.          TabIndex        =   8
  486.          Top             =   2640
  487.          Width           =   495
  488.       End
  489.       Begin CheckBox Drv 
  490.          BackColor       =   &H00C0C0C0&
  491.          Caption         =   "G:"
  492.          Enabled         =   0   'False
  493.          Height          =   255
  494.          Index           =   6
  495.          Left            =   120
  496.          TabIndex        =   7
  497.          Top             =   2400
  498.          Width           =   495
  499.       End
  500.       Begin CheckBox Drv 
  501.          BackColor       =   &H00C0C0C0&
  502.          Caption         =   "F:"
  503.          Enabled         =   0   'False
  504.          Height          =   255
  505.          Index           =   5
  506.          Left            =   120
  507.          TabIndex        =   6
  508.          Top             =   2160
  509.          Width           =   495
  510.       End
  511.       Begin CheckBox Drv 
  512.          BackColor       =   &H00C0C0C0&
  513.          Caption         =   "E:"
  514.          Enabled         =   0   'False
  515.          Height          =   255
  516.          Index           =   4
  517.          Left            =   120
  518.          TabIndex        =   5
  519.          Top             =   1920
  520.          Width           =   495
  521.       End
  522.       Begin CheckBox Drv 
  523.          BackColor       =   &H00C0C0C0&
  524.          Caption         =   "D:"
  525.          Enabled         =   0   'False
  526.          Height          =   255
  527.          Index           =   3
  528.          Left            =   120
  529.          TabIndex        =   4
  530.          Top             =   1680
  531.          Width           =   495
  532.       End
  533.       Begin CheckBox Drv 
  534.          BackColor       =   &H00C0C0C0&
  535.          Caption         =   "C:"
  536.          Enabled         =   0   'False
  537.          Height          =   255
  538.          Index           =   2
  539.          Left            =   120
  540.          TabIndex        =   3
  541.          Top             =   1440
  542.          Width           =   495
  543.       End
  544.       Begin CheckBox Drv 
  545.          BackColor       =   &H00C0C0C0&
  546.          Caption         =   "B:"
  547.          Enabled         =   0   'False
  548.          Height          =   255
  549.          Index           =   1
  550.          Left            =   120
  551.          TabIndex        =   2
  552.          Top             =   1200
  553.          Width           =   495
  554.       End
  555.       Begin CheckBox Drv 
  556.          BackColor       =   &H00C0C0C0&
  557.          Caption         =   "A:"
  558.          Enabled         =   0   'False
  559.          ForeColor       =   &H00000000&
  560.          Height          =   255
  561.          Index           =   0
  562.          Left            =   120
  563.          TabIndex        =   1
  564.          Top             =   960
  565.          Width           =   495
  566.       End
  567.       Begin Line Line1 
  568.          X1              =   720
  569.          X2              =   720
  570.          Y1              =   960
  571.          Y2              =   4080
  572.       End
  573.    End
  574.    Begin Line Line4 
  575.       BorderColor     =   &H00FFFFFF&
  576.       X1              =   8
  577.       X2              =   456
  578.       Y1              =   345
  579.       Y2              =   345
  580.    End
  581.    Begin Label Label6 
  582.       Alignment       =   2  'Center
  583.       BackStyle       =   0  'Transparent
  584.       Caption         =   "DriveSpeed 3.10"
  585.       FontBold        =   -1  'True
  586.       FontItalic      =   -1  'True
  587.       FontName        =   "Times New Roman"
  588.       FontSize        =   18
  589.       FontStrikethru  =   0   'False
  590.       FontUnderline   =   0   'False
  591.       Height          =   915
  592.       Left            =   4680
  593.       TabIndex        =   50
  594.       Top             =   240
  595.       Width           =   1815
  596.    End
  597.    Begin Line Line2 
  598.       BorderWidth     =   3
  599.       X1              =   8
  600.       X2              =   456
  601.       Y1              =   344
  602.       Y2              =   344
  603.    End
  604.    Begin Label Label5 
  605.       BackColor       =   &H00FFFFFF&
  606.       BackStyle       =   0  'Transparent
  607.       Caption         =   "Latest status:"
  608.       Height          =   255
  609.       Left            =   1920
  610.       TabIndex        =   51
  611.       Top             =   3360
  612.       Width           =   1215
  613.    End
  614. '  DRSPCC - DriveSpeed Control Center for DriveSpeed version 3.10 (GPL FREEWARE)
  615. '  Copyleft (l) Stanislav Sokolov, May 2000 and onwards.
  616. '  This program is subject to GNU General Public License ver. 2 of June 1991
  617. '  and any later version.
  618. '  You may use this source with your programs, provided
  619. '  due credits are given.
  620. '  Contact the author by e-mail: stanislavs@hotmail.com
  621. '  Internet:  http://members.tripod.com/~stanislavs/prog/prog.htm
  622. DefInt A-Z
  623. Option Explicit
  624. Dim Params(0 To 25) As Parameters
  625. Dim NL As String
  626. Dim CurDrv As Integer
  627. Dim Stopped As Integer
  628. Dim Running As Integer
  629. Dim DrspHWnd As Integer
  630. Sub Batch_Help_Click ()
  631.     Dim t As String
  632.     t = "Check this box if you want DRSP to run in batch mode." & NL & NL
  633.     t = t & "In batch mode DRSP will not go interactive if any of the parameters are wrong. It will neither ask for comments before writing the results to the log-file." & NL & NL
  634.     t = t & "It is highly recommended to choose batch mode in case you are testing multiple drives. (Remember to choose this mode for all the drives that you are going to test!)"
  635.     MsgBox t, 64, "Help on ""Batch mode"""
  636. End Sub
  637. Sub Drsp_do_Click ()
  638.     Dim i, RetVal
  639.     Dim Coml As String
  640.     Dim ResPath As String, tmp As String
  641.     Static res(-2 To 13) As String
  642.     res(-2) = "Can't execute"
  643.     res(-1) = "Not available"
  644.     res(0) = "Normal exit"
  645.     res(1) = "Aborted by user"
  646.     res(2) = "Can't write results to the log-file"
  647.     res(3) = "Can't open file"
  648.     res(4) = "Can't write to file"
  649.     res(5) = "Can't close a file"
  650.     res(6) = "Can't delete a file"
  651.     res(7) = "DOS ver too old"
  652.     res(8) = "Out of memory"
  653.     res(9) = "Math error - select a larger test-file size"
  654.     res(10) = "No such drive or drive not ready"
  655.     res(11) = "Test-size too small or too large - too few files on drive in read-only test"
  656.     res(12) = "Bad number of turns selected"
  657.     'Update data
  658.     Drv_MouseDown CurDrv, 2, 0, 0, 0
  659.     Stopped = False
  660.     Running = True
  661.     Drsp_do.Enabled = False
  662.     Quit.Enabled = False
  663.     Drives.Enabled = False
  664.     RO.Enabled = False
  665.     Parameters.Enabled = False
  666.     stop_t.Enabled = True
  667.     Status.Text = ""
  668.     For i = 0 To 25
  669.         If Drv(i).Value = 1 Then
  670.             Coml = LCase$(Drv(i).Caption) & " " & "/s" & Trim$(Str$(Params(i).Size)) & " "
  671.             If Params(i).RO = 0 Or Params(i).Mode = 2 Then Coml = Coml + "/t" & Trim$(Str$(Params(i).Turns)) & " "
  672.             If Params(i).RO = 1 Then
  673.                 If Params(i).Mode = 1 Then
  674.                     Coml = Coml & "/rs "
  675.                 Else
  676.                     Coml = Coml & "/rm "
  677.                 End If
  678.             End If
  679.             If Params(i).Batch = 1 Then Coml = Coml & "/b "
  680.             If Log_f.Text <> "" Then Coml = Coml & "/l" & LCase$(Log_f.Text) & " "
  681.             
  682.             Status.SelText = "Staring test:" + NL + "  drsp " + Coml + NL
  683.             
  684.             'Run DRSP and wait until it is finished.
  685.             RetVal = 0
  686.             DrspHWnd = WinExec(AppPath & RunFile & " " & Coml & "/f /k", 8)
  687.             If DrspHWnd < 32 Then
  688.                 RetVal = -2
  689.             Else
  690.                 Do: DoEvents: Loop Until GetModuleUsage(DrspHWnd) = 0
  691.                 DoEvents
  692.                 On Error GoTo ResTrap
  693.                 
  694.                 'Generate the path & filename, where the result value is stored.
  695.                 'If you find how to make Windows to report the return status of program,
  696.                 'please e-mail me.
  697.                 ResPath = "C:\"
  698.                 tmp = Environ$("TEMP")
  699.                 If tmp = "" Then tmp = Environ$("TMP")
  700.                 If tmp <> "" Then ResPath = tmp
  701.                 If Right$(ResPath, 1) <> "\" Then ResPath = ResPath & "\"
  702.                 
  703.                 'Read the result
  704.                 Open ResPath & ResFile For Input As #1
  705.                     Input #1, RetVal
  706.                 Close #1
  707.                 Kill ResPath & ResFile
  708. NoResFile:
  709.                 On Error GoTo 0
  710.             End If
  711.             
  712.             Status.SelText = "  Result: " & res(RetVal) & "." & NL & "Done." & NL & NL
  713.             SearchFile  'Read log-file
  714.             
  715.             'Check if the Stop-button is pressed
  716.             If Stopped Then Exit For
  717.         End If
  718.     Next i
  719.     stop_t.Enabled = False
  720.     Drives.Enabled = True
  721.     RO.Enabled = True
  722.     Parameters.Enabled = True
  723.     Drsp_do.Enabled = True
  724.     Quit.Enabled = True
  725.     Running = False
  726.     Exit Sub
  727. ResTrap:
  728.     RetVal = -1
  729.     Resume NoResFile
  730. End Sub
  731. Sub Drv_all_Click ()
  732.     Dim i
  733.     For i = 0 To 25
  734.         If Drv(i).Enabled Then Drv(i).Value = Drv_all.Value
  735.     Next i
  736. End Sub
  737. Sub Drv_Help_Click ()
  738.     Dim t As String
  739.     t = "Here you select the drives you wish to test" & NL & NL
  740.     t = t & "You may select multiple drives from the ones that are available." & NL & NL
  741.     t = t & "When you click a check-box, the parameters that you selected for that drive will be loaded. The modified parameters are saved when you select another drive. The currently active drive is marked with red." & NL & NL
  742.     t = t & "Right-click the check-boxes to edit a new drive's parameters without changing its on/off status."
  743.     MsgBox t, 64, "Help on ""Drives"""
  744. End Sub
  745. Sub Drv_MouseDown (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  746.     If CurDrv <> -1 Then
  747.         Drv(CurDrv).ForeColor = 0
  748.         RemChar Size, ",", "."
  749.         Params(CurDrv).Size = Val(Size.Text)
  750.         Params(CurDrv).Turns = Val(Turns.Text)
  751.         Params(CurDrv).Batch = Batch.Value
  752.         Params(CurDrv).RO = RO_tgl.Value
  753.         If RSW(0).Value Then
  754.             Params(CurDrv).Mode = 1
  755.         Else
  756.             Params(CurDrv).Mode = 2
  757.         End If
  758.     End If
  759.     Drv(Index).ForeColor = &HFF
  760.     CurDrv = Index
  761.     Size.Text = Trim$(Str$(Params(CurDrv).Size))
  762.     Turns.Text = Params(CurDrv).Turns
  763.     TScroll.Value = Params(CurDrv).Turns
  764.     Batch.Value = Params(CurDrv).Batch
  765.     RO_tgl.Value = Params(CurDrv).RO
  766.     If Params(CurDrv).Mode = 1 Then
  767.         RSW(0).Value = True
  768.     Else
  769.         RSW(1).Value = True
  770.     End If
  771.     RO_tgl_Click
  772. End Sub
  773. Sub Form_Load ()
  774.     Dim i
  775.     If App.PrevInstance Then
  776.         MsgBox "Can't run two instances of " & ProgName & " at once!", 48 + 4096, ProgName
  777.         End
  778.     End If
  779.     Left = (Screen.Width - Width) / 2
  780.     Top = (Screen.Height - Height) / 2
  781.     NL = Chr$(13) & Chr$(10)
  782.     AppPath = App.Path
  783.     If Right$(AppPath, 1) <> "\" Then AppPath = AppPath & "\"
  784.     Form1.Caption = ProgName
  785.     Form2.Caption = ProgName & " - Select the log-file"
  786.     Form3.Caption = ProgName & " - Log-file viewer"
  787.     i = SendMessage(Status.hWnd, EM_SETREADONLY, True, 0)
  788.     i = SendMessage(Form3.Viewer.hWnd, EM_SETREADONLY, True, 0)
  789.     For i = 0 To Form2.Drive1.ListCount - 1
  790.         Drv(Asc(Form2.Drive1.List(i)) - 97).Enabled = True
  791.     Next i
  792.     'Load defaults
  793.     For i = 0 To 25
  794.         Params(i).Size = 1
  795.         Params(i).Turns = 3
  796.         Params(i).Batch = 0
  797.         Params(i).RO = 0
  798.         Params(i).Mode = 1
  799.     Next i
  800.     'Load saved data
  801.     On Error GoTo Trap
  802.     Open AppPath & SavFile For Input As #1: Close #1
  803.     Open AppPath & SavFile For Random As #1 Len = RecLen
  804.         For i = 0 To 25
  805.             Get #1, i + 1, Params(i)
  806.         Next i
  807.     Close #1
  808.     On Error GoTo 0
  809. NoFile:
  810.     'Select active drive
  811.     CurDrv = -1
  812.     For i = 0 To 25
  813.         If Drv(i).Enabled Then
  814.             Drv_MouseDown i, 2, 0, 0, 0
  815.             Exit For
  816.         End If
  817.     Next i
  818.     Exit Sub
  819. Trap:
  820.     Resume NoFile
  821. End Sub
  822. Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
  823.     If Running Then
  824.         MsgBox "You can't quit " & ProgName & " while the tests are running. Press Stop first!", 16, ProgName
  825.         Cancel = True
  826.         Exit Sub
  827.     End If
  828.     If MsgBox("Do you really wish to quit " & ProgName & "?", 4 + 32, ProgName) = 7 Then Cancel = True
  829. End Sub
  830. Sub Form_Unload (Cancel As Integer)
  831.     Dim i
  832.     Unload Form2
  833.     'Update drive parameters
  834.     Drv_MouseDown CurDrv, 2, 0, 0, 0
  835.     'Load saved data
  836.     On Error GoTo Trap1
  837.     Open AppPath & SavFile For Random As #1 Len = RecLen
  838.         For i = 0 To 25
  839.             Put #1, i + 1, Params(i)
  840.         Next i
  841.     Close #1
  842. Trap1:
  843.     End
  844. End Sub
  845. Sub Label6_Click ()
  846.     Dim t As String
  847.     t = ProgName & ", ver. 3.10, GPL Freeware." & NL
  848.     t = t & "Copyleft (l) Stanislav Sokolov, May 2000 and onwards." & NL & NL
  849.     t = t & "This is a Windows front-end for DriveSpeed 3.10, designed to make testings easier and less scary..."
  850.     MsgBox t, , ProgName
  851. End Sub
  852. Sub Log_f_LostFocus ()
  853.     RemChar Log_f, " ", ""
  854.     Log_f.Text = UCase$(Log_f.Text)
  855.     SearchFile
  856. End Sub
  857. Sub Log_Help_Click ()
  858.     Dim t As String
  859.     t = "Here you can select the log-file that DRSP will append the test results to. If the file does not exist, it will be created." & NL & NL
  860.     t = t & "If, for some reason, DRSP fails to write to the file, it will attempt using the default DRSP.LOG, placing it in the same directory as the DRSP.EXE. Leave the field blank to make DRSP use the default filename and location." & NL & NL
  861.     t = t & "Please, keep to the 8.3 convention. Note that the log-file is common for all the drives that you test."
  862.     MsgBox t, 64, "Help on ""Select log-file"""
  863. End Sub
  864. Sub Log_sel_Click ()
  865.     'Brows base directory
  866.     Form2.Show 1
  867.     If Form2.Ok_btn.Tag <> "" Then Log_f.Text = UCase$(Form2.Ok_btn.Tag)
  868.     SearchFile
  869. End Sub
  870. Sub Quit_Click ()
  871.     Unload Form1
  872. End Sub
  873. Sub ReadFile (LogFile As String)
  874.     Dim Text As String, tmp As String
  875.     Dim i, j
  876.     Dim start As Long
  877.     ReDim s(9) As String, r(9) As String
  878.     s(1) = "
  879. ": r(1) = "-"
  880.     s(2) = "
  881. ": r(2) = "|"
  882.     s(3) = "
  883. ": r(3) = "+"
  884.     s(4) = "
  885. ": r(4) = "+"
  886.     s(5) = "
  887. ": r(5) = "+"
  888.     s(6) = "
  889. ": r(6) = "+"
  890.     s(7) = "
  891. ": r(7) = "+"
  892.     s(8) = "
  893. ": r(8) = "+"
  894.     s(9) = "
  895. ": r(9) = "+"
  896.     On Error GoTo View_Trap
  897.     Form3.Viewer.Text = ""
  898.     Open LogFile For Input As #1: Close #1
  899.     Open LogFile For Binary As #1
  900.         If LOF(1) > 32600 Then
  901.             Form3.Viewer.Text = "Log-file is larger than 32600 bytes!" & NL & "Displaying the last 32600 bytes." & NL & NL & NL
  902.             start = LOF(1) - 32599
  903.             Text = Space$(32600)
  904.         Else
  905.             start = 1
  906.             Text = Space$(LOF(1))
  907.         End If
  908.         Get #1, start, Text
  909.     Close #1
  910.     On Error GoTo 0
  911.     'Go through the file and replace DOS pseudo-graphics
  912.     For i = 1 To 9
  913.         j = InStr(Text, s(i))
  914.         While j <> 0
  915.             Mid$(Text, j, 1) = r(i)
  916.             j = InStr(j + 1, Text, s(i))
  917.         Wend
  918.     Next i
  919.     Form3.Viewer.Text = Form3.Viewer.Text + Text
  920.     Form3.Viewer.SelStart = Len(Form3.Viewer.Text)
  921.     Form3.LogName.Caption = UCase$(LogFile)
  922.     Form3.DoPrint.Enabled = True
  923.     Exit Sub
  924. View_Trap:
  925.     Form3.Viewer.Text = "Log-file not found or it has not been created yet." & NL & "Errorcode:" & Str$(Err)
  926.     Form3.LogName.Caption = ""
  927.     Close #1
  928.     Exit Sub
  929. End Sub
  930. Sub RemChar (C As Control, in As String, out As String)
  931.     Dim i
  932.     C.Text = Trim$(C.Text)
  933.     i = InStr(C.Text, in)
  934.     While i <> 0
  935.         C.Text = Left$(C.Text, i - 1) & out & Mid$(C.Text, i + 1)
  936.         i = InStr(C.Text, in)
  937.     Wend
  938. End Sub
  939. Sub RO_Help_Click ()
  940.     Dim t As String
  941.     t = "Check the ""Read-only mode"" box if you want to run a read-only test on a spesific drive. Select then one of the two modes of testing. Note that in ""single-pass"" mode the ""Number of turns"" text-box is greyed out." & NL & NL
  942.     t = t & """Single-pass mode"" is more accurate. It is performed by finding 17 largest files on the drive and reading them in seqence. Thus, caching does not affect this test." & NL & NL
  943.     t = t & """Multi-pass mode"" gives slightly faster results due to caching. It finds the largest file on the drive and reads it ""Number of turns"" times." & NL & NL
  944.     t = t & "If you attempt running DRSP on a read-only drive without first selecting a read-only mode, DRSP will automaticly run in the multi-pass mode. This mode is chosen for compatibility reasons."
  945.     MsgBox t, 64, "Help on ""Read-only mode"""
  946. End Sub
  947. Sub RO_tgl_Click ()
  948.     If RO_tgl.Value = 1 Then
  949.         RSW(0).Enabled = True
  950.         RSW(1).Enabled = True
  951.         RSW_Click (0)
  952.     Else
  953.         RSW(0).Enabled = False
  954.         RSW(1).Enabled = False
  955.         RSW_Click (0)
  956.     End If
  957. End Sub
  958. Sub RSW_Click (Index As Integer)
  959.    If RSW(1).Value And RO_tgl.Value = 1 Then
  960.         Turns.Enabled = True
  961.         TScroll.Enabled = True
  962.    ElseIf RSW(0).Value And RO_tgl.Value = 1 Then
  963.         Turns.Enabled = False
  964.         TScroll.Enabled = False
  965.    Else
  966.         Turns.Enabled = True
  967.         TScroll.Enabled = True
  968.    End If
  969. End Sub
  970. Sub SearchFile ()
  971.     Dim LogFile As String, TryPath As String, Path As String
  972.     Dim ErrFlag, i, start_t, stop_t
  973.     On Error GoTo Try
  974.     Form3.DoPrint.Enabled = False
  975.     'Try selected file
  976.     ErrFlag = False
  977.     LogFile = Form1.Log_f.Text
  978.     Open LogFile For Input As #1: Close #1
  979.     If Not ErrFlag Then
  980.         ReadFile LogFile
  981.         Exit Sub
  982.     End If
  983.     'Try current dir
  984.     ErrFlag = False
  985.     Open ".\DRSP.EXE" For Input As #1: Close #1
  986.     If Not ErrFlag Then
  987.         ReadFile ".\DRSP.LOG"
  988.         Exit Sub
  989.     End If
  990.     'Try WINDOWS dir
  991.     ErrFlag = False
  992.     TryPath = Space(80)
  993.     i = GetWindowsDirectory(TryPath, 80)
  994.     If i > 0 Then
  995.         TryPath = Trim$(TryPath)
  996.         TryPath = Left$(TryPath, Len(TryPath) - 1)
  997.         If Right$(TryPath, 1) <> "\" Then TryPath = TryPath & "\"
  998.         Open TryPath & "DRSP.EXE" For Input As #1: Close #1
  999.         If Not ErrFlag Then
  1000.             ReadFile TryPath & "DRSP.LOG"
  1001.             Exit Sub
  1002.         End If
  1003.     End If
  1004.     'Try SYSTEM dir
  1005.     ErrFlag = False
  1006.     TryPath = Space(80)
  1007.     i = GetSystemDirectory(TryPath, 80)
  1008.     If i > 0 Then
  1009.         TryPath = Trim$(TryPath)
  1010.         TryPath = Left$(TryPath, Len(TryPath) - 1)
  1011.         If Right$(TryPath, 1) <> "\" Then TryPath = TryPath & "\"
  1012.         Open TryPath & "DRSP.EXE" For Input As #1: Close #1
  1013.         If Not ErrFlag Then
  1014.             ReadFile TryPath & "DRSP.LOG"
  1015.             Exit Sub
  1016.         End If
  1017.     End If
  1018.     'Try module dir
  1019.     ErrFlag = False
  1020.     Open AppPath & "DRSP.EXE" For Input As #1: Close #1
  1021.     If Not ErrFlag Then
  1022.         ReadFile AppPath & "DRSP.LOG"
  1023.         Exit Sub
  1024.     End If
  1025.     'Try PATH envir
  1026.     Path = Environ$("PATH")
  1027.     start_t = 1
  1028.     stop_t = InStr(Path, ";")
  1029.     If stop_t = 0 Then stop_t = Len(Path)
  1030.     Do
  1031.         ErrFlag = False
  1032.         TryPath = Mid$(Path, start_t, stop_t - start_t)
  1033.         If Right$(TryPath, 1) <> "\" Then TryPath = TryPath & "\"
  1034.         Open TryPath & "DRSP.EXE" For Input As #1: Close #1
  1035.         If Not ErrFlag Then
  1036.             ReadFile TryPath & "DRSP.LOG"
  1037.             Exit Sub
  1038.         End If
  1039.         
  1040.         start_t = stop_t + 1
  1041.         stop_t = InStr(start_t + 1, Path, ";")
  1042.         If stop_t = 0 Then stop_t = Len(Path) + 1
  1043.     Loop While start_t <> Len(Path) + 2
  1044.     On Error GoTo 0
  1045.     Form3.Viewer.Text = "Log-file not found or it has not been created yet."
  1046.     Form3.LogName.Caption = ""
  1047.     Form3.DoPrint.Enabled = True
  1048. Exit Sub
  1049.     ErrFlag = True
  1050.     Resume Next
  1051. End Sub
  1052. Sub Size_Help_Click ()
  1053.     Dim t As String
  1054.     t = "Here you specify the size of a test-file or a selection of files." + NL + NL
  1055.     t = t & "In read-write mode this is the size of the file that DRSP will generate in the root directory of the selected drive. If the size is too big, DRSP will ajust it to fit in." & NL & NL
  1056.     t = t & "In read-only multi-pass mode DRSP will search for a file that is no larger than the specified size." & NL & NL
  1057.     t = t & "In read-only sigle-pass mode DRSP will search for 17 largest files so that the total sum of the sizes does not exceed the size specified." & NL & NL
  1058.     t = t & "The valid range is 0.2MB through 999.99MB."
  1059.     MsgBox t, 64, "Help on ""Test-file size"""
  1060. End Sub
  1061. Sub Size_LostFocus ()
  1062.     RemChar Size, ",", "."
  1063.     If Val(Size.Text) < .2 Then Size.Text = "0.2"
  1064.     If Val(Size.Text) > 999.99 Then Size.Text = "999.99"
  1065. End Sub
  1066. Sub SScroll_Change ()
  1067.     Static Changing
  1068.     'Critical region
  1069.     If Not Changing Then
  1070.         Changing = True
  1071.         If SScroll.Value > Val(SScroll.Tag) Then
  1072.             Size.Text = Val(Size.Text) + .8
  1073.             If SScroll.Value = 999 Then SScroll.Value = 1
  1074.         ElseIf SScroll.Value < Val(SScroll.Tag) Then
  1075.             Size.Text = Val(Size.Text) - .8
  1076.             If SScroll.Value = 1 Then SScroll.Value = 999
  1077.         End If
  1078.         SScroll.Tag = SScroll.Value
  1079.         Size_LostFocus
  1080.         Changing = False
  1081.     End If
  1082. End Sub
  1083. Sub Stop_t_Click ()
  1084.     Dim i
  1085.     Stopped = True
  1086.     stop_t.Enabled = False
  1087.     Status.SelText = NL & NL & "Stop requested..." & NL & "Please wait until the current test is complete" & NL & "or press 'Esc' 1-2 times in the DriveSpeed window." & NL
  1088. End Sub
  1089. Sub TScroll_Change ()
  1090.     Turns.Text = TScroll.Value
  1091. End Sub
  1092. Sub Turns_Help_Click ()
  1093.     Dim t As String
  1094.     t = "Here you specify the number of times the test-file is read and/or written in read-write and read-only multi-pass modes." & NL & NL
  1095.     t = t & "If you choose the read-only single-pass mode this option will be unavailable." & NL & NL
  1096.     t = t & "The valid range is 3 through 999."
  1097.     MsgBox t, 64, "Help on ""Number of turns"""
  1098. End Sub
  1099. Sub Turns_LostFocus ()
  1100.     If Val(Turns.Text) < 3 Then Turns.Text = "3"
  1101.     If Val(Turns.Text) > 999 Then Turns.Text = "999"
  1102.     TScroll.Value = Val(Turns.Text)
  1103. End Sub
  1104. Sub View_Click ()
  1105.     SearchFile
  1106.     Form3.Show
  1107. End Sub
  1108.