Ver Mensaje Individual
  #2  
Antiguo 29-04-2007
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Reputación: 26
seoane Va por buen camino
Prueba con esta función:
Código Delphi [-]
function StrToBin(Str: string): string;
var
  i,j,k: Integer;
begin
  Result:= '';
  for i:=  1 to Length(Str) do
  begin
    j:= Byte(Str[i]);
    k:= 128;
    while k > 0 do
    begin
      if j >= k then
      begin
        Result:= Result + '1';
        j:= j - k;
      end else
        Result:= Result + '0';
      k:= k shr 1;
    end;
  end;
end;

Por ejemplo:
Código Delphi [-]

ShowMessage(StrToBin(':( '));

Ahora volviendo a tu código:
Código Delphi [-]
// StrToInt puede convertir números decimales
Result:=StrToInt(HexNum) ;
// y hexadecimales, pero entonces hay que anteponer '$'
Result:=StrToInt('$' + HexNum) ;
Responder Con Cita