学习官方示例 - System.Hi、System.Lo


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.


 
   

你可能感兴趣的:(System)