高手呢?!智力超群的人呢?!如果你认为你行,你进来看看!(200分)

  • 主题发起人 主题发起人 m_g_g
  • 开始时间 开始时间
M

m_g_g

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什么的地址错误!


不好意思,吸引你进来,有点夸张了!UP者有份!
 
少文件了
 
你的线程变量是局部的还是全局的?
 
to zw84611:
Mail这个线程变量对一个线程来是全局变量,你没懂吗?
 
怎么都UP,没有人回答吗?
 
后退
顶部