Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.68 KB | None | 0 0
  1. procedure TForm1.Button2Click(Sender: TObject);
  2. var
  3.   Arquivo: TMemoryStream;
  4.   ArquivoString: string;
  5. begin
  6.   if FileExists(Edit1.Text) then begin
  7.     Arquivo := TMemoryStream.Create;
  8.     Arquivo.LoadFromFile(Edit1.Text);
  9.     ArquivoString := MemoryStreamToString(Arquivo);
  10.     ArquivoString := Crypt(ArquivoString, Edit2.Text);
  11.     Arquivo.Free;
  12.     Arquivo := TMemoryStream.Create;
  13.     Arquivo.WriteBuffer(Pointer(ArquivoString)^, Length(ArquivoString));
  14.     if SaveDialog1.Execute then begin
  15.       Arquivo.SaveToFile(SaveDialog1.FileName);
  16.       Application.MessageBox('Saved successfully!', 'Warning', 64);
  17.     end;
  18.     Arquivo.Free;
  19.     ArquivoString := '';
  20.   end;
  21.  
  22. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement