delphi中application的事件在哪里写代码?
请问下,delphi中application的事件在哪里写代码?比如我要在application的onactive的事件中写代码,在哪里写。
[解决办法]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure myAppActive(Sender: TObject);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnActivate := myAppActive;
end;
procedure TForm1.myAppActive(Sender: TObject);
begin
ShowMessage('aaa');
end;
end.
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.