elmago00,
Continuación del
Msg #34
Una pequeña corrección
:
Código Delphi
[-]
procedure TForm1.SaveDumpBinary(aFileName:TFileName; const BPF: Word);
var
MS: TMemoryStream;
c,r: Integer;
Buffer: Byte;
Msg : String;
begin
with StringGrid1 do
begin
MS:= TMemoryStream.Create;
try
for r:= 1 to RowCount-1 do
begin
for c:= 0 to BPF-1 do
begin
if (Cells[c+1, r] <> '') then
begin
Buffer := StrToInt('$'+Cells[c+1, r]);
MS.WriteBuffer(Buffer, 1);
end;
end;
end;
MS.SaveToFile(aFileName);
finally
MS.Free;
Msg := 'Generación de Archivo Binario Completada Satisfactoriamente';
MessageDlg(Msg,TMsgDlgType.mtInformation,[TMsgDlgBtn.mbOk],0);
end;
end;
end;
Código Delphi
[-]
procedure TForm1.Button5Click(Sender: TObject);
var
BPF : Integer;
begin
with SaveDialog1 do
begin
Filter:= '*.*';
BPF := StrToInt(ComboBox1.Items.Strings[ComboBox1.ItemIndex]);
if Execute then SaveDumpBinary(FileName, BPF);
end;
end;
El código anterior en Delphi XE4 bajo Windows 7 Professional x32, corrige el código del
Msg #34 en los casos en que
los archivos a visualizar no sean múltiplos del factor de visualización (BPF), como se muestra en la siguiente imagen:
Suerte en tu proyecto
Nelson.