Пропускать сообщения от клавиатуры и мышки в своем приложении
Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch
{
Connect a handler to the Application.OnMessage event.
You have to do this in code:
}
private
procedure AppOnMessage(var Msg: TMsg; var Handled: Boolean);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
FConnected: Boolean;
procedure TForm1.AppOnMessage(var Msg: TMsg; var Handled: Boolean);
begin
if FConnected then
case Msg.Message of
WM_KEYFIRST..WM_KEYLAST, // Keyboard events
WM_MOUSEFIRST..WM_MOUSELAST: // Mouse events
Handled := True
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage := AppOnMessage;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Application.OnMessage := nil;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FConnected := True;
end;
|