unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, OleCtrls, SHDocVw, StdCtrls;type
  TForm1 = class(TForm)
    Button1: TButton;
    WebBrowser1: TWebBrowser;
    Edit1: TEdit;
    Edit2: TEdit;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
      procedure ProcessMsg(var Msg: TMsg; var Handled: Boolean);
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.ProcessMsg(var Msg: TMsg; var Handled: Boolean);
begin
  with Msg do
  begin
    if message=WM_KEYDOWN then
    begin
     Edit2.Clear;
     Edit2.Text:=IntToStr(Msg.wParam);
    end;
  end;end;
procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnMessage := ProcessMsg;
end;end.按任意键 显示他的asii码