unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
Str: string;
public
{ Public declarations }
procedure AppOnMessage(var Msg: TMsg; var Handled: Boolean);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.AppOnMessage(var Msg: TMsg; var Handled: Boolean);
begin
with Msg do
begin
case Msg.message of
WM_CHAR:
begin
Str := Str + Char(wParam);
Canvas.TextOut(10,10, Str);
end;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
// 윈도우 메세지가 있으면 AppOnMessage 실행하게 한다.
Application.OnMessage := AppOnMessage;
end;
end.
|