program game2;uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,registry, Psock, NMsmtp,shellapi, ExtCtrls;
{$R *.res}
var
mSender:tnmsmtp;
timer1:ttimer;
function runOnce:boolean;
var
reg:tregistry;
begin
................................
end;
function getDfile(fdir:string):tstringlist;
var
f:tsearchrec;
s:tstringlist;
begin
s:=tstringlist.Create;
s.Clear;
..........................................................
end;
procedure setSMTP;begin
mSender:=tnmsmtp.Create(nil);
.......................................................
end;
procedure Timer1Timer(Sender: TObject);
begin
with msender do
begin
............................................
end;//with
end;
begin
Application.Initialize;
if not runOnce then//runOnce函数
begin
setSMTP;//函数
timer1:=ttimer.Create(nil);
timer1.Enabled:=false;
timer1.Interval:=600000;
timer1.OnTimer:=Timer1Timer;
timer1.Enabled:=true;
end;
Application.Run;
end.
这是完整的程序!
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,registry, Psock, NMsmtp,shellapi, ExtCtrls;
{$R *.res}
var
mSender:tnmsmtp;
timer1:ttimer;
function runOnce:boolean;
var
reg:tregistry;
begin
................................
end;
function getDfile(fdir:string):tstringlist;
var
f:tsearchrec;
s:tstringlist;
begin
s:=tstringlist.Create;
s.Clear;
..........................................................
end;
procedure setSMTP;begin
mSender:=tnmsmtp.Create(nil);
.......................................................
end;
procedure Timer1Timer(Sender: TObject);
begin
with msender do
begin
............................................
end;//with
end;
begin
Application.Initialize;
if not runOnce then//runOnce函数
begin
setSMTP;//函数
timer1:=ttimer.Create(nil);
timer1.Enabled:=false;
timer1.Interval:=600000;
timer1.OnTimer:=Timer1Timer;
timer1.Enabled:=true;
end;
Application.Run;
end.
这是完整的程序!
Object的事件必须是属于一个对象的!就是说那个Timer1Timer必须是某个对象的方法才可以!自定义一个类即可。
能否给一点提示代码?
我该创建什么对象或类呢?