Ver Mensaje Individual
  #3  
Antiguo 19-11-2014
Avatar de nlsgarcia
[nlsgarcia] nlsgarcia is offline
Miembro Premium
 
Registrado: feb 2007
Ubicación: Caracas, Venezuela
Posts: 2.206
Reputación: 21
nlsgarcia Tiene un aura espectacularnlsgarcia Tiene un aura espectacular
elmago00,

Cita:
Empezado por elmago00
...¿Cómo convertir un Integer a Hexadecimal?...El valor Integer que utilizo es 256312456892254...Como hago para generar el mismo hexadecimal 082A6513426598224500000000000000...


Revisa este código:
Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, StrUtils, UBigIntsV4;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// Convertir Decimal a Hexadecimal
procedure TForm1.Button1Click(Sender: TObject);
var
   Hex : TInteger;
begin
   Hex := TInteger.Create(0);
   Hex.Assign(Edit1.Text);
   Edit2.Text := Hex.ConvertToHexString;
   Hex.Free;
end;

// Convertir Hexadecimal a Decimal
procedure TForm1.Button2Click(Sender: TObject);
var
   Dec : TInteger;
begin
   Dec := TInteger.Create(0);
   Dec.AssignHex(Edit1.Text);
   Edit2.Text := Dec.ConvertToDecimalString(False);
   Dec.Free;
end;

end.
El código anterior en Delphi 2010 bajo Windows 7 Professional x32, convierte números de Decimal a Hexadecimal y viceversa por medio de DFF Library, como se puede ver en la siguiente imagen:



Espero sea útil

Nelson.
Responder Con Cita