Ver Mensaje Individual
  #9  
Antiguo 25-10-2008
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Reputación: 24
seoane Va por buen camino
Prueba asi
Código Delphi [-]
 function BinToHex(Hex: String): String;
var
  i,j: Integer;
  Str: String;
begin
  Result:= EmptyStr;
  for i:= Length(Hex)  downto 1 do
    if not (Hex[i] in ['0','1']) then
      Delete(Hex,i,1);
  while Length(Hex) mod 4 <> 0 do
     Hex:= '0' + Hex;
  while Length(Hex) > 0 do
  begin
    Str:= Copy(Hex,1,4);
    Delete(Hex,1,4);
    j:= 0;
    for i:= 1 to Length(Str) do
      j:= (j * 2) + StrToInt(Str[i]);
    Result:= Result + IntToHex(j,1);
  end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
   Edit1.Text:= BinToHex(ACC7.Caption + ACC6.Caption + ACC5.Caption + ACC4.Caption + ACC3.Caption
  + ACC2.Caption + ACC1.Caption + ACC0.Caption);
end;
Responder Con Cita