From: Felipe Rocha Machado To: Subject: Computer Lab Feedback Date: Thursday, May 06, 1999 7:34 AM Hello Earl, I am very glad to write this to you. Your articles and sample programs helped me a lot (hey! now I've made a component that can show a grayed version of an image while the mouse is outside it and the original color version when the mouse is over... without blinking... thank you! :-)... But, I am not writting only to say hello and thanks! I have a little feedback to give to you... Remember the CRC calculator? You've stated the following in the source code: "source quote" // In D3 there is no way to print an unsigned 4-byte integer, so // some CRC-32 values in decimal may be negative. In D4, all values // are unsigned. // // Test CRC-16 CRC-32 // String Dec Hex Dec Hex // ------- ----- ---- ---------- -------- // abc 38712 9738 -891568579 CADBBE3D (D3) // 3403398717 CADBBE3D (D4) // // ABC 17697 4521 1551695031 5C7CFCB7 (D3/D4) "end" well, It is right. But we forgot that there is the "Integer" type Currency, that is a 64 bit scaled integer that could do the job for us, so I write the following routine and voila: we can now print a 32 bit integer in D3: function DWORDToStr(v: DWORD): String; var c: Currency; begin if (High(DWORD) <> 2147483647) or (v >= 0) then Result := IntToStr(v) else begin c := 4294967296.0+v; // remember: (4294967296 = 2^32) and v is negative! Result := CurrToStr(c); end; end; I've changed the source for the CRC calculator to read the following: procedure TCRCCalc.CRCTextChange(Sender: TObject); VAR CRC16: WORD; CRC32: DWORD; s : STRING; begin s := CRCText.Text; CRC16 := 0; // Could use $FFFF or other initial value IF LENGTH(s) > 0 // Avoid access violation in D4 THEN CalcCRC16 (Addr(s[1]), LENGTH(s), CRC16); CRC16Decimal.Caption := IntToStr(CRC16); CRC16Hex.Caption := IntToHex(CRC16,4); CRC32 := $FFFFFFFF; // To match PKZIP IF LENGTH(s) > 0 // Avoid access violation in D4 THEN CalcCRC32 (Addr(s[1]), LENGTH(s), CRC32); CRC32Decimal.Caption := DWORDToStr(CRC32); //IntToStr(CRC32); Now it prints 3403398717 for 'abc' CRC32Hex.Caption := IntToHex(CRC32,8); end; Test it yourself, it works (or seems to work...) Goodbye from your brazillian friend, Felipe Rocha Machado GPS Tecnologia Ltda. PS.: May your family keep their patience :-) cause your work is for the best of us all!