Prev: And now the news from VODC Germany
Next: JPG to BMP
From: Lars Broberg on 16 Nov 2006 13:34 Lennart, Good to hear it worked at last! Regards Lars Broberg Elbe-Data AB lars at elbe-data dot se Lennart Bj?rk wrote: > This was a real lesson! I do thank everybody who has helped me. > First I tried all these hints to use psz instead of strings. It was a > good try with many variations. They all had one characteristic in > common. I was kicked out with an enlightning message about 5333. > > The hint from Ronny Michiels helped me through. With a more recent > version of the dll I made it. The code: > > _dll function CRC_String(pszInput as psz, nOptions as longint) as > longint pascal:diCryptoSys.CRC_String > > method CRC_Test() class Shell > local pszInput as psz > local liOutput as longint > local sOutput as string > pszInput := String2Psz("123456789") > liOutput := CRC_String(pszInput,0) // Zero as nOptions ??? > sOutput := AsHexString(liOutput) > // Now I have a correct result in sOutput to show > return > > However, the dll diCryptoSys.DLL is not free. So if I want to save my > money I have to be a bit more obstinate with the original DLL. And with > the assistance from Robert van der Hulst I made it on the very first > try. His hint that 'Using the C function is much easier' made me rewrite > the method above like > > method CRC_Test() class Shell > local cInput as string > local pOutPut as ptr > local nLen as dword > local cOutPut as string > cInput := "123456789" > nLen := SLen(cInPut) > pOutPut := MemAlloc(nLen) > cHEX_CRC32(pOutPut, Cast2Psz(cInput), nLen) > cOutPut := Mem2String(pOutPut,nLen) > MemFree(pOutPut) > // Now I have a correct result in cOutput to show > return > > Robert left some coding for me. What about the _dll-function? > I tested with > _dll function cHEX_CRC32(pOutput as ptr, pszInput as psz, dwLen as > dword) as ptr pascal:diCrEnc.cHEX_CRC32 > and it seems to work. > > Regards > Lennart Bj?rk |