unit Unit1; interface uses SysUtils, Forms, crc32, ComCtrls, StdCtrls, ExtCtrls, Classes, Controls, Dialogs; type TForm1 = class(TForm) Panel1: TPanel; Button1: TButton; ProgressCRC: TProgressBar; OpenDialog1: TOpenDialog; Label1: TLabel; FileEdit: TEdit; CRC32Text: TEdit; procedure Button1Click(Sender: TObject); procedure AnalyzeFile(Filename: TFilename); private public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} const NotCalc='--Not Calculated--'; procedure UpdateProgress(Percent:Integer); begin Form1.ProgressCRC.Position:=Percent; Form1.Refresh; Application.ProcessMessages; end; procedure TForm1.AnalyzeFile(Filename: TFilename); begin FileEdit.Text:=Filename; Screen.Cursor:=crHourGlass; Application.Title:='Analyzing'; ProgressCRC.Top:=CRC32Text.Top; UpdateProgress(0); ProgressCRC.Visible:=True; Form1.Refresh; try CRC32Text.Text:=IntToHex(FileCRC32(FileName,@UpdateProgress),8); if CRCError then CRC32Text.Text:='Error'; finally ProgressCRC.Visible:=False; Form1.Refresh; Application.Title:='CRC32: '+ExtractFileName(Filename); Screen.Cursor:=crDefault; end; end; procedure TForm1.Button1Click(Sender: TObject); begin if FileExists(Form1.Caption) then OpenDialog1.FileName:=Form1.Caption; if OpenDialog1.Execute then AnalyzeFile(OpenDialog1.Filename); end; end.