unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
procedure FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
FOldWndProc : TWndMethod;
procedure MyWndProc(
var Msg: TMessage);
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
CanClose:=True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FOldWndProc := Self.WindowProc;
// alte Fensterproceure merken
Self.WindowProc:= MyWndProc;
// Fensterproceure auf eigene Fensterprocedure umbiegen
end;
procedure TForm1.MyWndProc(
var Msg: TMessage);
begin
If Msg.Msg = WM_NCLBUTTONDOWN
then
begin
FOldWndProc(Msg);
end
else FOldWndProc(Msg);
// alte Fensterproceure aufrufen
end;
end.