home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 35 / hot35.iso / ficheros / LVB / T2W32543.ZIP / _CRC32.FRM < prev    next >
Text File  |  1998-05-21  |  6KB  |  238 lines

  1. VERSION 5.00
  2. Begin VB.Form frmCrc32 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Crc 32"
  5.    ClientHeight    =   4845
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   7485
  9.    MaxButton       =   0   'False
  10.    MDIChild        =   -1  'True
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   4845
  13.    ScaleWidth      =   7485
  14.    ShowInTaskbar   =   0   'False
  15.    Begin VB.Frame Frame1 
  16.       Height          =   570
  17.       Left            =   0
  18.       TabIndex        =   1
  19.       Top             =   -90
  20.       Width           =   7485
  21.       Begin VB.CommandButton cmdNP 
  22.          Caption         =   ">"
  23.          Height          =   285
  24.          Index           =   1
  25.          Left            =   7110
  26.          TabIndex        =   6
  27.          Top             =   195
  28.          Width           =   285
  29.       End
  30.       Begin VB.CommandButton cmdNP 
  31.          Caption         =   "<"
  32.          Height          =   285
  33.          Index           =   0
  34.          Left            =   6210
  35.          TabIndex        =   5
  36.          Top             =   195
  37.          Width           =   285
  38.       End
  39.       Begin VB.CommandButton Command1 
  40.          Caption         =   "&Go"
  41.          Default         =   -1  'True
  42.          Height          =   285
  43.          Left            =   6570
  44.          TabIndex        =   4
  45.          Top             =   195
  46.          Width           =   465
  47.       End
  48.       Begin VB.ComboBox cmb_Function 
  49.          Height          =   315
  50.          Left            =   1365
  51.          TabIndex        =   2
  52.          Top             =   180
  53.          Width           =   4755
  54.       End
  55.       Begin VB.Label Label2 
  56.          Caption         =   "&Select a function"
  57.          Height          =   255
  58.          Left            =   90
  59.          TabIndex        =   3
  60.          Top             =   210
  61.          Width           =   1275
  62.       End
  63.    End
  64.    Begin VB.TextBox txt_Result 
  65.       BackColor       =   &H00C0C0C0&
  66.       BorderStyle     =   0  'None
  67.       Height          =   4110
  68.       Left            =   105
  69.       Locked          =   -1  'True
  70.       MultiLine       =   -1  'True
  71.       ScrollBars      =   2  'Vertical
  72.       TabIndex        =   0
  73.       Top             =   630
  74.       Width           =   7260
  75.    End
  76. End
  77. Attribute VB_Name = "frmCrc32"
  78. Attribute VB_GlobalNameSpace = False
  79. Attribute VB_Creatable = False
  80. Attribute VB_PredeclaredId = True
  81. Attribute VB_Exposed = False
  82. Option Explicit
  83. Option Base 1
  84.  
  85. Private Const Iteration = 25
  86.  
  87. Dim IsLoaded         As Integer
  88.  
  89. Dim TimerStartOk     As Integer
  90. Dim TimerCloseOk     As Integer
  91.  
  92. Dim TimerHandle      As Integer
  93. Dim TimerValue       As Long
  94.  
  95. Private Sub cmb_Function_Click()
  96.    
  97.    If (IsLoaded = False) Then Exit Sub
  98.    
  99.    Call cDisableFI(mdiT2W.Picture1)
  100.    
  101.    txt_Result = ""
  102.    
  103.    DoEvents
  104.    
  105.    Select Case cmb_Function.ListIndex
  106.       Case 0
  107.          Call TestFileCRC32
  108.       Case 1
  109.          Call TestStringCRC32
  110.    End Select
  111.  
  112.    DoEvents
  113.    Call cEnableFI(mdiT2W.Picture1)
  114.    
  115. End Sub
  116.  
  117.  
  118. Private Sub cmdNP_Click(Index As Integer)
  119.  
  120.    Call sub_NextPrev(cmb_Function, Index)
  121.  
  122. End Sub
  123.  
  124. Private Sub Form_Activate()
  125.  
  126.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  127.  
  128. End Sub
  129.  
  130. Private Sub Form_Load()
  131.  
  132.    IsLoaded = False
  133.    
  134.    Show
  135.  
  136.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_crc32.t2w")
  137.    
  138.    IsLoaded = True
  139.    
  140. End Sub
  141.  
  142. Private Sub Command1_Click()
  143.    
  144.    Call cmb_Function_Click
  145.    
  146. End Sub
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154. Private Sub TestFileCRC32()
  155.  
  156.    Dim lResult          As Long
  157.    Dim strResult        As String
  158.    Dim strDisplay       As String
  159.    
  160.    Dim i                As Integer
  161.    
  162.    Dim File1            As String
  163.    
  164.    strResult = ""
  165.    strDisplay = ""
  166.    
  167.    File1 = T2WFileTest
  168.    strDisplay = strDisplay & "Crc32 (text mode) for '" & File1 & "' is " & cFileCRC32(File1, OPEN_MODE_TEXT) & vbCrLf
  169.    strDisplay = strDisplay & "Crc32 (binary mode) for '" & File1 & "' is " & cFileCRC32(File1, OPEN_MODE_BINARY) & vbCrLf & vbCrLf
  170.  
  171.    File1 = "c:\config.sys"
  172.    strDisplay = strDisplay & "Crc32 (text mode) for '" & File1 & "' is " & cFileCRC32(File1, OPEN_MODE_TEXT) & vbCrLf
  173.    strDisplay = strDisplay & "Crc32 (binary mode) for '" & File1 & "' is " & cFileCRC32(File1, OPEN_MODE_BINARY) & vbCrLf & vbCrLf
  174.  
  175.    File1 = "c:\command.com"
  176.    strDisplay = strDisplay & "Crc32 (text mode) for '" & File1 & "' is " & cFileCRC32(File1, OPEN_MODE_TEXT) & vbCrLf
  177.    strDisplay = strDisplay & "Crc32 (binary mode) for '" & File1 & "' is " & cFileCRC32(File1, OPEN_MODE_BINARY) & vbCrLf & vbCrLf
  178.  
  179.    File1 = cGetWindowsDirectory() & "\system.dat"
  180.    strDisplay = strDisplay & "Crc32 (text mode) for '" & File1 & "' is " & cFileCRC32(File1, OPEN_MODE_TEXT) & vbCrLf
  181.    strDisplay = strDisplay & "Crc32 (binary mode) for '" & File1 & "' is " & cFileCRC32(File1, OPEN_MODE_BINARY) & vbCrLf & vbCrLf
  182.  
  183.    txt_Result = strDisplay
  184.  
  185.    'time the function
  186.  
  187.    TimerHandle = cTimerOpen()
  188.    TimerStartOk = cTimerStart(TimerHandle)
  189.    
  190.    For i = 1 To Iteration
  191.       lResult = cFileCRC32(File1, OPEN_MODE_TEXT)
  192.    Next i
  193.    
  194.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  195.    
  196.    TimerCloseOk = cTimerClose(TimerHandle)
  197.  
  198. End Sub
  199.  
  200. Public Sub TestStringCRC32()
  201.  
  202.    Dim lResult          As Long
  203.    Dim strResult        As String
  204.    Dim strDisplay       As String
  205.    
  206.    Dim i                As Integer
  207.    
  208.    Dim Str1            As String
  209.    
  210.    strResult = ""
  211.    strDisplay = ""
  212.    
  213.    Str1 = "T2WIN-32, t2win-32"
  214.    strDisplay = strDisplay & "Crc32 for '" & Str1 & "' is " & cStringCRC32(Str1) & vbCrLf & vbCrLf
  215.  
  216.    Str1 = "Windows 95/NT : Hints and Tips"
  217.    strDisplay = strDisplay & "Crc32 for '" & Str1 & "' is " & cStringCRC32(Str1) & vbCrLf & vbCrLf
  218.  
  219.    Str1 = "Under the sky, the sun lights"
  220.    strDisplay = strDisplay & "Crc32 for '" & Str1 & "' is " & cStringCRC32(Str1) & vbCrLf & vbCrLf
  221.  
  222.    txt_Result = strDisplay
  223.  
  224.    'time the function
  225.  
  226.    TimerHandle = cTimerOpen()
  227.    TimerStartOk = cTimerStart(TimerHandle)
  228.    
  229.    For i = 1 To Iteration
  230.       lResult = cStringCRC32(Str1)
  231.    Next i
  232.    
  233.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  234.    
  235.    TimerCloseOk = cTimerClose(TimerHandle)
  236.  
  237. End Sub
  238.