home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / wg_lib / filefrm2.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-06  |  6.9 KB  |  237 lines

  1. VERSION 2.00
  2. Begin Form FileFrm2 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Faster File I/O"
  5.    ClientHeight    =   3390
  6.    ClientLeft      =   1260
  7.    ClientTop       =   1710
  8.    ClientWidth     =   7170
  9.    Height          =   3795
  10.    Left            =   1200
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   3390
  14.    ScaleWidth      =   7170
  15.    Top             =   1365
  16.    Width           =   7290
  17.    Begin Frame Frame2 
  18.       BackColor       =   &H00C0C0C0&
  19.       Height          =   2415
  20.       Left            =   3750
  21.       TabIndex        =   7
  22.       Top             =   615
  23.       Width           =   3015
  24.       Begin CommandButton Command2 
  25.          Caption         =   "Execute"
  26.          Height          =   390
  27.          Left            =   930
  28.          TabIndex        =   10
  29.          Top             =   930
  30.          Width           =   810
  31.       End
  32.       Begin OptionButton VOpt 
  33.          BackColor       =   &H00C0C0C0&
  34.          Caption         =   "Read From File"
  35.          Height          =   285
  36.          Index           =   2
  37.          Left            =   420
  38.          TabIndex        =   9
  39.          Top             =   525
  40.          Visible         =   0   'False
  41.          Width           =   1980
  42.       End
  43.       Begin OptionButton VOpt 
  44.          BackColor       =   &H00C0C0C0&
  45.          Caption         =   "Write To File"
  46.          Height          =   255
  47.          Index           =   1
  48.          Left            =   420
  49.          TabIndex        =   8
  50.          Top             =   195
  51.          Value           =   -1  'True
  52.          Width           =   2025
  53.       End
  54.       Begin Label VRes 
  55.          BackColor       =   &H00FFFFFF&
  56.          Height          =   270
  57.          Left            =   150
  58.          TabIndex        =   12
  59.          Top             =   1920
  60.          Width           =   2700
  61.       End
  62.       Begin Label VMsg 
  63.          Height          =   255
  64.          Left            =   165
  65.          TabIndex        =   11
  66.          Top             =   1515
  67.          Width           =   2685
  68.       End
  69.    End
  70.    Begin Frame Frame1 
  71.       BackColor       =   &H00C0C0C0&
  72.       Height          =   2415
  73.       Left            =   330
  74.       TabIndex        =   0
  75.       Top             =   615
  76.       Width           =   3015
  77.       Begin CommandButton Command1 
  78.          Caption         =   "Execute"
  79.          Height          =   375
  80.          Left            =   1080
  81.          TabIndex        =   2
  82.          Top             =   960
  83.          Width           =   855
  84.       End
  85.       Begin OptionButton IOpt 
  86.          BackColor       =   &H00C0C0C0&
  87.          Caption         =   "Read From File"
  88.          Height          =   255
  89.          Index           =   2
  90.          Left            =   360
  91.          TabIndex        =   5
  92.          Top             =   600
  93.          Visible         =   0   'False
  94.          Width           =   2295
  95.       End
  96.       Begin OptionButton IOpt 
  97.          BackColor       =   &H00C0C0C0&
  98.          Caption         =   "Write To File"
  99.          Height          =   255
  100.          Index           =   1
  101.          Left            =   360
  102.          TabIndex        =   4
  103.          Top             =   225
  104.          Value           =   -1  'True
  105.          Width           =   2175
  106.       End
  107.       Begin Label IRes 
  108.          BackColor       =   &H00FFFFFF&
  109.          ForeColor       =   &H00000000&
  110.          Height          =   255
  111.          Left            =   225
  112.          TabIndex        =   6
  113.          Top             =   1950
  114.          Width           =   2550
  115.       End
  116.       Begin Label IMSg 
  117.          BackColor       =   &H00FFFFFF&
  118.          Height          =   240
  119.          Left            =   225
  120.          TabIndex        =   3
  121.          Top             =   1500
  122.          Width           =   2535
  123.       End
  124.    End
  125.    Begin Label Label6 
  126.       BackColor       =   &H00C0C0C0&
  127.       Caption         =   "Normal VB "
  128.       Height          =   210
  129.       Left            =   3765
  130.       TabIndex        =   13
  131.       Top             =   375
  132.       Width           =   1830
  133.    End
  134.    Begin Label Label1 
  135.       BackColor       =   &H00C0C0C0&
  136.       Caption         =   "InfoSoft I/O"
  137.       Height          =   255
  138.       Left            =   330
  139.       TabIndex        =   1
  140.       Top             =   375
  141.       Width           =   1335
  142.    End
  143. DefInt A-Z
  144. Dim IFil As String
  145. Dim VFil As String
  146. Sub Command1_Click ()
  147.     IMsg.Caption = "Creating random file"
  148.     IRes.Caption = ""
  149.     IRes.Refresh
  150.     quan = 3500
  151.     ReDim Test(1 To quan) As TStruct
  152.     If IOpt(1).value Then
  153.         For x = 1 To quan
  154.             Test(x).i = x
  155.             Test(x).l = x
  156.             Test(x).s = String$(6, "!")
  157.         Next x
  158.     End If
  159.     IMsg.Caption = "Memory structure done. Starting timer"
  160.     IMsg.Refresh
  161.     IFil$ = "ITest.fil"
  162.     s! = Timer
  163.     If IOpt(1).value Then
  164.         IMsg.Caption = "Outputting to file"
  165.         errc = FCreat(IFil$, Fhandle)
  166.     Else
  167.         IMsg.Caption = "Reading from file"
  168.         errc = FOpen(IFil$, Fhandle)
  169.     End If
  170.     IMsg.Refresh
  171.     siz = Len(Test(1))
  172.     If IOpt(1).value Then
  173.         errc = FRecPutA(Fhandle, quan, siz, Test(1))
  174.         IOpt(2).Visible = 1
  175.     Else
  176.         errc = FRecGetA(Fhandle, quan, siz, Test(1))
  177.     End If
  178.     el! = Timer - s!
  179.     errc = FClose(Fhandle)
  180.     IRes.Caption = "Our I/O ops took " + Format$(el!) + " secs"
  181.     IMsg.Caption = "Done"
  182. End Sub
  183. Sub Command2_Click ()
  184.     VMsg.Caption = "Creating random file"
  185.     VRes.Caption = ""
  186.     VRes.Refresh
  187.     quan = 3500
  188.     ReDim Test(1 To quan) As TStruct
  189.     If VOpt(1).value Then
  190.         For x = 1 To quan
  191.             Test(x).i = x
  192.             Test(x).l = x
  193.             Test(x).s = String$(6, "!")
  194.         Next x
  195.     End If
  196.     VMsg.Caption = "Memory structure done. Starting timer"
  197.     VMsg.Refresh
  198.     VFil$ = "VTest.fil"
  199.     s! = Timer
  200.     If VOpt(1).value Then
  201.         VMsg.Caption = "Outputting to file"
  202.         fh = FreeFile
  203.         Open VFil$ For Random As #fh Len = Len(Test(1))
  204.     Else
  205.         VMsg.Caption = "Reading from file"
  206.         fh = FreeFile
  207.         Open VFil$ For Random As #fh Len = Len(Test(1))
  208.     End If
  209.     VMsg.Refresh
  210.     siz = Len(Test(1))
  211.     If VOpt(1).value Then
  212.         For x = 1 To quan
  213.             Put #fh, x, Test(x)
  214.         Next x
  215.         VOpt(2).Visible = 1
  216.     Else
  217.         For x = 1 To quan
  218.             Get #fh, x, Test(x)
  219.         Next x
  220.     End If
  221.     el! = Timer - s!
  222.     Close #fh
  223.     VRes.Caption = "VB I/O ops took " + Str$(el!) + " secs"
  224.     VMsg.Caption = "Done"
  225. End Sub
  226. Sub Form_Paint ()
  227.      ConvexFrm FileFrm2, 5
  228.      ConcaveCtl IMsg, 3
  229.      ConcaveCtl IRes, 3
  230.      ConcaveCtl VMsg, 3
  231.      ConcaveCtl VRes, 3
  232. End Sub
  233. Sub Form_Unload (Cancel As Integer)
  234.      If Fexists(IFil$) Then Kill IFil$
  235.      If Fexists(VFil$) Then Kill VFil$
  236. End Sub
  237.