Hallo Manuel,
der folgende Code läuft bei mir.
Ich habe jetzt zum Testen nur 2 Memo1 benutzt
aber vom Ablauf sollte es mit Deinem StringGrid ähnlich laufen.
Delphi-Quellcode:
procedure encodeFile(fileName:TFileName;mStream:TMemoryStream);
var
x: TRCxContext;
outStream : TMemoryStream;
begin
outStream := TMemoryStream.create;
outStream.size := mStream.size;
RCxInit(x,'Passwort');
RCxenCode(x,mStream.memory^,outStream.memory^,mStream.size);
RcxDone(x);
outStream.saveToFile(fileName);
outStream.free;
end;
procedure decodeFile(fileName:TFileName;mStream:TMemoryStream);
var
x: TRCxContext;
outStream: TMemoryStream;
begin
outStream := TMemoryStream.Create;
mStream.loadfromFile(fileName);
outStream.size := mStream.size;
RCxInit(x,'Passwort');
RCxdeCode(x,mStream.memory^,outStream.memory^,mStream.size); // entschlüsseln
RcxDone(x);
mStream.LoadFromStream(outStream);
outStream.Free;
end;
// verschlüsseln
procedure TForm1.Button1Click(Sender: TObject);
var
mStream : TMemoryStream;
begin
mStream := TMemoryStream.Create;
memo1.Lines.SaveToStream(mStream);
encodeFile('d:\rcxtest.dat',mStream);
mStream.free;
end;
// entschlüsseln
procedure TForm1.Button2Click(Sender: TObject);
var
mStream : TMemoryStream;
begin
mStream := TMemoryStream.Create;
decodeFile('d:\rcxtest.dat',mStream);
memo2.Lines.LoadFromStream(mStream);
mStream.free;
end;
Grüße
Klaus