...early trap then Close Window procedure?
Author: Panthero - Michael
Procedure TForm1.HandleMessage(var Msg:TMessage);
begin
if msg.msg = WM_CLOSE //You can insert there other message constans from windows unit.
then
begin
{Your code when user clicked close button}
showmessage('You can not close this window!');
end
else form1.wndproc(msg); //if not closed system handle the message default
end;
procedure TForm1.Create(Sender:Tobject);
begin
form1.Windowproc:=form1.handlemessage; //run handling
end;
printed from
www.swissdelphicenter.ch
developers knowledge base