Q
qin_sir
Unregistered / Unconfirmed
GUEST, unregistred user!
这是我的程序
unit SendMailThread;
interface
uses
Classes,Dialogs,MailUnit,NewMailUnit,Sysutils;
type
SendMail2Thread = class(TThread)
private
procedure ThreadsSendMail;
protected
procedure Execute; override;
public
Constructor Create(MailMessage:array of OneMail);
end;
implementation
threadvar
Mail:array of OneMail;
constructor SendMail2Thread.Create(MailMessage:array of OneMail);
var
i:integer;
ArrayLength:integer;
begin
FreeOnTerminate:=True;
ArrayLength:=length(MailMessage);
setlength(Mail,ArrayLength);
for i:=0 to ArrayLength-1 do
begin
Mail:=MailMessage;
end;
inherited Create(False);
end;
procedure SendMail2Thread.Execute;
begin
FreeOnTerminate:=True;
Synchronize(ThreadsSendMail);
end;
Procedure SendMail2Thread.ThreadsSendMail;
var i:integer;
begin
for i:=0 to length(Mail)-1 do
begin
MailForm.SendMail(Mail,'202.96.199.133');
end;
end;
end.
单开一个线程没有任何问题,一开多现成就报错!老是弹出OX什么的地址错误!
unit SendMailThread;
interface
uses
Classes,Dialogs,MailUnit,NewMailUnit,Sysutils;
type
SendMail2Thread = class(TThread)
private
procedure ThreadsSendMail;
protected
procedure Execute; override;
public
Constructor Create(MailMessage:array of OneMail);
end;
implementation
threadvar
Mail:array of OneMail;
constructor SendMail2Thread.Create(MailMessage:array of OneMail);
var
i:integer;
ArrayLength:integer;
begin
FreeOnTerminate:=True;
ArrayLength:=length(MailMessage);
setlength(Mail,ArrayLength);
for i:=0 to ArrayLength-1 do
begin
Mail:=MailMessage;
end;
inherited Create(False);
end;
procedure SendMail2Thread.Execute;
begin
FreeOnTerminate:=True;
Synchronize(ThreadsSendMail);
end;
Procedure SendMail2Thread.ThreadsSendMail;
var i:integer;
begin
for i:=0 to length(Mail)-1 do
begin
MailForm.SendMail(Mail,'202.96.199.133');
end;
end;
end.
单开一个线程没有任何问题,一开多现成就报错!老是弹出OX什么的地址错误!