来晚了!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
procedure Edit1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Edit1Change(Sender: TObject);
var s: string;
i, j, k: integer;
a: array[1..1000] of char;
begin
s:='';
for i:=1 to Length(Edit1.Text) do begin
j:=Integer(Edit1.Text);
s:=s+Copy(Format('%X ',[j+$100]) ,2,3);
end;
Edit2.Text:=s;
StringToWideChar(Edit1.Text, @(a[1]), 500);
s:=''; i:=1;
while ((a<>#0) or (a[i+1]<>#0)) do begin
j:=Integer(a); k:=Integer(a[i+1]);
s:=s+Copy(Format('%X ',[j*$100+k+$10000]) ,2,5);
i:=i+2;
end;
Edit3.Text:=s;
end;
end.