vbAccelerator - Contents of code file: frmTestCRC32.frm

VERSION 5.00
Begin VB.Form frmTestCRC32 
   Caption         =   "CRC32 Tester"
   ClientHeight    =   3450
   ClientLeft      =   4110
   ClientTop       =   2355
   ClientWidth     =   5295
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmTestCRC32.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   3450
   ScaleWidth      =   5295
   Begin VB.Frame fraResults 
      Caption         =   "Results:"
      Height          =   1635
      Left            =   180
      TabIndex        =   4
      Top             =   1560
      Width           =   4935
      Begin VB.TextBox txtTime 
         Height          =   315
         Left            =   960
         TabIndex        =   10
         Top             =   960
         Width           =   3855
      End
      Begin VB.TextBox txtCRC32 
         Height          =   315
         Left            =   960
         TabIndex        =   8
         Top             =   600
         Width           =   3855
      End
      Begin VB.TextBox txtFileSize 
         Height          =   315
         Left            =   960
         TabIndex        =   6
         Top             =   240
         Width           =   3855
      End
      Begin VB.Label lblTime 
         Caption         =   "Time:"
         Height          =   255
         Left            =   180
         TabIndex        =   9
         Top             =   1020
         Width           =   735
      End
      Begin VB.Label lblCRC32 
         Caption         =   "CRC32:"
         Height          =   255
         Left            =   180
         TabIndex        =   7
         Top             =   660
         Width           =   735
      End
      Begin VB.Label lblFileSize 
         Caption         =   "File Size:"
         Height          =   255
         Left            =   180
         TabIndex        =   5
         Top             =   300
         Width           =   735
      End
   End
   Begin VB.CommandButton cmdPick 
      Caption         =   "..."
      Height          =   315
      Left            =   4680
      TabIndex        =   3
      ToolTipText     =   "Pick File"
      Top             =   420
      Width           =   435
   End
   Begin VB.TextBox txtFileName 
      Height          =   315
      Left            =   120
      TabIndex        =   1
      Text            =   "txtFileName"
      Top             =   420
      Width           =   4515
   End
   Begin VB.CommandButton cmdHash 
      Caption         =   "&Hash"
      Height          =   495
      Left            =   120
      TabIndex        =   0
      Top             =   840
      Width           =   1215
   End
   Begin VB.Label lblFilename 
      Caption         =   "File name:"
      Height          =   255
      Left            =   180
      TabIndex        =   2
      Top             =   120
      Width           =   3495
   End
End
Attribute VB_Name = "frmTestCRC32"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdHash_Click()
   
   Dim cStream As New cBinaryFileStream
   cStream.File = txtFileName.Text
   
   Dim cCRC32 As New cCRC32
   Dim lCRC32 As Long
   
   Dim cTimer As New cHiResTimer
   cTimer.StartTimer
   lCRC32 = cCRC32.GetFileCrc32(cStream)
   cTimer.StopTimer
   
   txtFileSize.Text = cStream.Length
   txtCRC32.Text = Hex(lCRC32)
   txtTime.Text = cTimer.ElapsedTime
   
End Sub

Private Sub cmdPick_Click()
   Dim c As New cCommonDialog
   Dim sFileName As String
   If (c.VBGetOpenFileName( _
      Filename:=sFileName, _
      Owner:=Me.hWnd)) Then
      txtFileName.Text = sFileName
   End If
End Sub

Private Sub Form_Load()
   txtFileName.Text = App.Path & "\" & App.EXEName & ".exe"
End Sub