Find all our projects in development below.
All source code is GNU General Public License (GPL)
Browsing QuickQuery HL Edition/GetCRC32/MainForm.frm (5.12 KB)
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form MainForm
BorderStyle = 1 'Fixed Single
Caption = "Get CRC32 Value"
ClientHeight = 1395
ClientLeft = 45
ClientTop = 435
ClientWidth = 4965
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "MainForm.frx":0000
MaxButton = 0 'False
ScaleHeight = 1395
ScaleWidth = 4965
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Command3
Caption = "..."
Height = 255
Left = 4560
Style = 1 'Graphical
TabIndex = 2
ToolTipText = "Browse for file..."
Top = 140
Width = 300
End
Begin MSComDlg.CommonDialog FileDialog
Left = 0
Top = 360
_ExtentX = 847
_ExtentY = 847
_Version = 393216
CancelError = -1 'True
DialogTitle = "Open File..."
Filter = "All Files (*.*)|*.*"
End
Begin VB.CommandButton Command2
Caption = "E&xit"
Height = 375
Left = 2760
TabIndex = 4
Top = 480
Width = 1695
End
Begin VB.TextBox txtHex
Alignment = 2 'Center
BackColor = &H8000000F&
Height = 315
Left = 2760
Locked = -1 'True
TabIndex = 7
ToolTipText = "4-byte hexadecimal string of CRC32 value"
Top = 960
Width = 1695
End
Begin VB.TextBox txtInt
Alignment = 2 'Center
BackColor = &H8000000F&
Height = 315
Left = 960
Locked = -1 'True
TabIndex = 6
ToolTipText = "32-bit integer of CRC32 value"
Top = 960
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "&Calculate CRC32"
Enabled = 0 'False
Height = 375
Left = 960
TabIndex = 3
Top = 480
Width = 1695
End
Begin VB.TextBox txtFilename
Height = 315
Left = 960
MaxLength = 1000
TabIndex = 1
Top = 120
Width = 3495
End
Begin VB.Label lblCRC32
Caption = "C&RC32:"
Height = 255
Left = 120
TabIndex = 5
Top = 1000
Width = 735
End
Begin VB.Label lblFilename
Caption = "&Filename:"
Height = 255
Left = 120
TabIndex = 0
Top = 160
Width = 735
End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim cCRC32 As New clsCRC
Dim lFileCRC As Long
Dim sFileCRC As String
Dim N As Integer
Dim A As String
Dim X As Integer
txtFilename.Enabled = False
Command3.Enabled = False
Command1.Enabled = False
Command2.Enabled = False
txtInt.Text = ""
txtHex.Text = ""
cCRC32.Algorithm = CRC32
cCRC32.Clear
lFileCRC = CLng(cCRC32.CalculateFile(txtFilename.Text))
Set cCRC32 = Nothing
If lFileCRC = 0 Then
MsgBox "File not found.", vbExclamation
GoTo CleanUp
End If
txtInt.Text = lFileCRC
If Len(CStr(lFileCRC)) < 8 Then lFileCRC = String(8 - Len(CStr(lFileCRC)), "0") & Hex(lFileCRC)
sFileCRC = ""
For N = 1 To 4
A = "&H" & Mid(lFileCRC, ((N - 1) * 2) + 1, 1)
X = Val(A) * 16
A = "&H" & Mid(lFileCRC, ((N - 1) * 2) + 2, 1)
X = X + Val(A)
sFileCRC = sFileCRC & " " & Hex(X)
Next N
txtHex.Text = Trim(sFileCRC)
CleanUp:
txtFilename.Enabled = True
Command3.Enabled = True
Command1.Enabled = True
Command2.Enabled = True
Command1.SetFocus
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
On Error GoTo CancelErr
With FileDialog
.Filename = txtFilename.Text
.ShowOpen
txtFilename.Text = .Filename
End With
txtFilename.SetFocus
txtFilename.SelStart = 0
txtFilename.SelLength = Len(txtFilename.Text)
CancelErr:
End Sub
Private Sub txtFilename_Change()
If txtFilename.Text = "" Then
Command1.Enabled = False
Else
Command1.Enabled = True
End If
End Sub
Download QuickQuery HL Edition/GetCRC32/MainForm.frm