S
scorpions
Unregistered / Unconfirmed
GUEST, unregistred user!
我调用sakemail做的dll时,有参数错误。不知是dll文件的错还是调用时出错?
Tsakmsglist在哪释放??
我的dll:
library pd1;
uses
sharemem,
forms,
sakemail,
SysUtils,
Classes;
var
pop:Tsakpop;
list:Tsakmsglist;
procedure connect1(host1,user1,passwd1char;
var newmail1,mail1:integer);stdcall;
begin
try
pop:=Tsakpop.Create(Application);
list:=Tsakmsglist.Create(Application);
pop.Host:=host1;
pop.UserId:=user1;
pop.Passwd:=passwd1;
pop.Connect ;
pop.Login ;
newmail1:=pop.Init ;
mail1:=pop.MsgsCount ;
pop.RetrieveAllMessages(list);
pop.Quit ;
finally
pop.free;
end;
end;
procedure show1(s:integer;var from1,subject1,date1,msgid1,text1,anamechar);
stdcall;
var
i:integer;
msg:Tsakmsg;
begin
msg:=list.Items;
from1:=pchar(msg.From );
subject1:=pchar(msg.Subject);
date1:=pchar(msg.Date);
msgid1:=pchar(msg.MessageId );
text1:=pchar(msg.Text.Text);
if msg.AttachedFiles.Count >0 then
begin
for i:=0 to msg.AttachedFiles.Count-1 do
aname:=pchar(msg.AttachedFiles.FileName );
end;
end;
procedure del1(s:integer); stdcall;
begin
list.Delete(s);
end;
exports
connect1,
show1,
del1;
begin
end.
调用dll:
unit pe1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Button1: TButton;
Edit6: TEdit;
Button2: TButton;
Button3: TButton;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
ComboBox1: TComboBox;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
procedure connect1(host1,user1,passwd1char;
var newmail1,mail1:integer);stdcall;
external'pd1.dll';
procedure show1(s:integer;var from1,subject1,date1,msgid1,text1,anamechar);
stdcall;external'p2.dll';
procedure del1(s:integer); stdcall;
external'pd1.dll';
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
host1,user1,passwd1char;
mail1,newmail1:integer;
begin
host1:=pchar(edit1.Text) ;
user1:=pchar(edit2.Text) ;
passwd1:=pchar(edit3.Text) ;
connect1(host1,user1,passwd1,newmail1,mail1);
edit4.text:=inttostr(newmail1);
edit5.text:=inttostr(mail1);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
s:integer;
begin
s:=strtoint(edit6.text);
del1(s);
end;
procedure TForm1.Button3Click(Sender: TObject);
var
s:integer;
from1,subject1,date1,msgid1,text1,anamechar;
begin
s:=strtoint(edit6.text);
show1(s,from1,subject1,date1,msgid1,text1,aname);
edit7.text:=string(from1);
edit8.text:=string(subject1);
edit9.text:=string(date1);
edit10.text:=string(msgid1);
combobox1.Items.Clear ;
combobox1.Items.Text:=string(aname);
memo1.Lines.Text:=string(text1);
end;
end.
Tsakmsglist在哪释放??
我的dll:
library pd1;
uses
sharemem,
forms,
sakemail,
SysUtils,
Classes;
var
pop:Tsakpop;
list:Tsakmsglist;
procedure connect1(host1,user1,passwd1char;
var newmail1,mail1:integer);stdcall;
begin
try
pop:=Tsakpop.Create(Application);
list:=Tsakmsglist.Create(Application);
pop.Host:=host1;
pop.UserId:=user1;
pop.Passwd:=passwd1;
pop.Connect ;
pop.Login ;
newmail1:=pop.Init ;
mail1:=pop.MsgsCount ;
pop.RetrieveAllMessages(list);
pop.Quit ;
finally
pop.free;
end;
end;
procedure show1(s:integer;var from1,subject1,date1,msgid1,text1,anamechar);
stdcall;
var
i:integer;
msg:Tsakmsg;
begin
msg:=list.Items
from1:=pchar(msg.From );
subject1:=pchar(msg.Subject);
date1:=pchar(msg.Date);
msgid1:=pchar(msg.MessageId );
text1:=pchar(msg.Text.Text);
if msg.AttachedFiles.Count >0 then
begin
for i:=0 to msg.AttachedFiles.Count-1 do
aname:=pchar(msg.AttachedFiles.FileName );
end;
end;
procedure del1(s:integer); stdcall;
begin
list.Delete(s);
end;
exports
connect1,
show1,
del1;
begin
end.
调用dll:
unit pe1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Button1: TButton;
Edit6: TEdit;
Button2: TButton;
Button3: TButton;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
ComboBox1: TComboBox;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
procedure connect1(host1,user1,passwd1char;
var newmail1,mail1:integer);stdcall;
external'pd1.dll';
procedure show1(s:integer;var from1,subject1,date1,msgid1,text1,anamechar);
stdcall;external'p2.dll';
procedure del1(s:integer); stdcall;
external'pd1.dll';
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
host1,user1,passwd1char;
mail1,newmail1:integer;
begin
host1:=pchar(edit1.Text) ;
user1:=pchar(edit2.Text) ;
passwd1:=pchar(edit3.Text) ;
connect1(host1,user1,passwd1,newmail1,mail1);
edit4.text:=inttostr(newmail1);
edit5.text:=inttostr(mail1);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
s:integer;
begin
s:=strtoint(edit6.text);
del1(s);
end;
procedure TForm1.Button3Click(Sender: TObject);
var
s:integer;
from1,subject1,date1,msgid1,text1,anamechar;
begin
s:=strtoint(edit6.text);
show1(s,from1,subject1,date1,msgid1,text1,aname);
edit7.text:=string(from1);
edit8.text:=string(subject1);
edit9.text:=string(date1);
edit10.text:=string(msgid1);
combobox1.Items.Clear ;
combobox1.Items.Text:=string(aname);
memo1.Lines.Text:=string(text1);
end;
end.