Subscribe:

Ads 468x60px

Loading

Senin, 04 Juli 2011

how to make "X" minimize the form?

try this.. works fine for me..



unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure WMSyscommand(Var msg: TWmSysCommand); message WM_SYSCOMMAND;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}


procedure TForm1.WMSyscommand(Var msg: TWmSysCommand); //message WM_SYSCOMMAND;
begin
if (msg.cmdtype and $FFF0) = SC_CLOSE then
Application.Minimize
else
inherited;
end;


//user can close if use windows shutdown,logoff or click the "close button in your app"
procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;

end.

0 komentar:

Posting Komentar