Thursday, 16 October 2008

Como evitar cerrar y mover un formulario en Delphi

Solo tenemos que capturar los mensajes que se envían de esta manera, y evitar que el formulario actue:




type
TForm1 = class(TForm)
procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHitTest;
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.WMNCHitTest(var Msg: TWMNCHitTest);
begin
inherited;
if Msg.Result = htClose then Msg.Result := 0;
if Msg.Result = htCaption then Msg.Result := htClient;
end;

0 comments:

Post a Comment