Показать сообщение отдельно
  #3  
Старый 16.03.2011, 08:47
Аватар для NumLock
NumLock NumLock вне форума
Let Me Show You
 
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
По умолчанию

Код:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    ApplicationEvents1: TApplicationEvents;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
    procedure ApplicationEvents1Activate(Sender: TObject);
    procedure ApplicationEvents1Deactivate(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Label1.Caption:=IntToStr(Tag);
  Tag:=Tag+1;
end;

procedure TForm1.ApplicationEvents1Activate(Sender: TObject);
begin
  Timer1.Enabled:=True;
end;

procedure TForm1.ApplicationEvents1Deactivate(Sender: TObject);
begin
  Timer1.Enabled:=False;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ApplicationEvents1.OnActivate:=ApplicationEvents1Activate;
  ApplicationEvents1.OnDeactivate:=ApplicationEvents1Deactivate;
  Timer1.Interval:=100;
  Timer1.OnTimer:=Timer1Timer;
end;

end.
__________________
Пишу программы за еду.
__________________
Ответить с цитированием