随笔 - 2146  文章 - 97 评论 - 11767 trackbacks - 253

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  万一  阅读(...)  评论(...编辑  收藏