unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  B : Byte;
begin
  B := Hi($1234);
  ShowMessage(Format('%x', [B])); {12}

  B := Hi($123456);
  ShowMessage(Format('%x', [B])); {34}

  B := Hi($12345678);
  ShowMessage(Format('%x', [B])); {56}
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  B : Byte;
begin
  B := Lo($1234);
  ShowMessage(Format('%x', [B])); {34}

  B := Lo($123456);
  ShowMessage(Format('%x', [B])); {56}

  B := Lo($12345678);
  ShowMessage(Format('%x', [B])); {78}
end;

end.

posted on 2008-09-11 00:26  万一  阅读(3528)  评论(2编辑  收藏  举报