本例功能: 切换窗口时让程序最小化.

代码文件:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    procedure AppDeactivate(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnDeactivate := AppDeactivate;
end;

procedure TForm1.AppDeactivate(Sender: TObject);
begin
  Application.Minimize;
end;

end.

posted on 2008-06-19 11:52  万一  阅读(3120)  评论(0编辑  收藏  举报