S
scorpion
Unregistered / Unconfirmed
GUEST, unregistred user!
本人有一问题需马上解决,希望您能帮我。
我用delphi5的nmsmtp控件做邮件发送程序的动态连接库。我先做成简单的应用
程序,实现邮件的发送。再转换成动态连接库。调用时可以实现邮件的发送,但
关闭窗体时显示错误。
Project *.exe raised exception class EInvalidpointer with
message 'Invalid pointer operation'.Process stopped.Use Step
or Run to continue.
请问是什么原因???
我的应用程序转换动态连接库的代码:
unit smtp1;
interface
uses
sharemem,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Psock, NMsmtp, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Button2: TButton;
OpenDialog1: TOpenDialog;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
procedure send1(host2,user2,from2,name2,to2,subject2,cc2,aname2,text2:string) ;
stdcall;export;
implementation
{$R *.DFM}
var
smtp:Tnmsmtp;
procedure send1(host2,user2,from2,name2,to2,subject2,cc2,aname2,text2:string) ;
begin
smtp:=Tnmsmtp.Create(Application);
smtp.host:=host2;
smtp.UserID:=user2;
smtp.Connect ;
smtp.PostMessage.FromAddress:=from2;
smtp.PostMessage.FromName:=name2;
smtp.PostMessage.ToAddress.Text:=to2;
smtp.PostMessage.Subject:=subject2;
smtp.PostMessage.ToCarbonCopy.Text:=cc2;
smtp.PostMessage.Attachments.text:=aname2;
smtp.PostMessage.Body.Text :=text2;
smtp.SendMail ;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
host2,user2,from2,name2,to2,subject2,cc2,aname2,text2:string;
begin
host2:=edit1.Text ;
user2:=edit2.Text ;
from2:=edit3.text;
name2:=edit4.Text ;
to2:=edit5.Text ;
subject2:=edit6.text;
cc2:=edit7.text;
aname2:=combobox1.Items.Text ;
text2:=memo1.Lines.Text ;
send1(host2,user2,from2,name2,to2,subject2,cc2,aname2,text2);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if opendialog1.Execute then
combobox1.Items.Add(opendialog1.filename);
end;
end.
转换动态连接库:
library smtpd;
uses
sharemem,
sysutils,
forms,
classes,
smtp1 in '../smtp/smtp1.pas' {Form1};
exports
send1;
begin
end.
接收邮件我用网上的sakemail控件。(delphi代的nmpop3控件接收附件时常出
问题,不知怎么截出日期)。
sakemail 的邮件接收程序调用动态连接库时也可接收邮件,关闭窗体时
和发送程序一样的错误。
我的应用程序转换动态连接库的代码:
unit pop3u2;
interface
uses
sharemem,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,sakemail;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
ComboBox1: TComboBox;
ListBox1: TListBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
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,passwd1:string;
var newmail1,mail1:integer);stdcall;export;
procedure show1(s:integer;var from1,subject1,date1,msgid1,text1,aname:string);
stdcall;export;
procedure del1(s:integer); stdcall;export;
implementation
{$R *.DFM}
var
pop:Tsakpop;
list:Tsakmsglist;
procedure create1;
begin
pop:=Tsakpop.Create(Application);
list:=Tsakmsglist.Create(Application);
end;
procedure connect1(host1,user1,passwd1:string;
var newmail1,mail1:integer);
begin
create1;
pop.Host:=host1;
pop.UserId:=user1;
pop.Passwd:=passwd1;
pop.Connect ;
if pop.POPError then
exit;
if not pop.Login then
exit;
newmail1:=pop.Init ;
mail1:=pop.MsgsCount ;
pop.RetrieveAllMessages(list);
pop.Quit ;
end;
procedure show1(s:integer;var from1,subject1,date1,msgid1,text1,aname:string);
var
i:integer;
msg:Tsakmsg;
begin
msg:=list.Items;
from1:=msg.From ;
subject1:=msg.Subject ;
date1:=msg.Date ;
msgid1:=msg.MessageId ;
text1:=msg.Text.Text ;
if msg.AttachedFiles.Count >0 then
begin
for i:=0 to msg.AttachedFiles.Count-1 do
aname:=msg.AttachedFiles.FileName ;
end;
end;
procedure del1(s:integer);
begin
list.Delete(s);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
host1,user1,passwd1:string;
mail1,newmail1:integer;
{mail1,newmail1:word}
begin
host1:=edit1.Text ;
user1:=edit2.Text ;
passwd1:=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;
from1,subject1,date1,msgid1,text1,aname:string;
begin
s:=strtoint(edit6.text);
show1(s,from1,subject1,date1,msgid1,text1,aname);
edit7.text:=from1;
edit8.text:=subject1;
edit9.text:=date1;
edit10.text:=msgid1;
combobox1.Items.Clear ;
combobox1.Items.Add(aname);
//combobox1.Items.text:=aname;
listbox1.Items.Text:=text1;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
s:integer;
begin
s:=strtoint(edit6.text);
del1(s);
end;
end.
转换动态连接库:
library pop3dll;
uses
sharemem,
sysutils,
classes,
pop3u2 in '../pop32/pop3u2.pas' {Form1};
exports
connect1,
show1,
del1;
begin
end.
请您帮我解决这个问题!!!
谢谢!!!
回信请寄:fsy_2000@sina.com
我用delphi5的nmsmtp控件做邮件发送程序的动态连接库。我先做成简单的应用
程序,实现邮件的发送。再转换成动态连接库。调用时可以实现邮件的发送,但
关闭窗体时显示错误。
Project *.exe raised exception class EInvalidpointer with
message 'Invalid pointer operation'.Process stopped.Use Step
or Run to continue.
请问是什么原因???
我的应用程序转换动态连接库的代码:
unit smtp1;
interface
uses
sharemem,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Psock, NMsmtp, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Button2: TButton;
OpenDialog1: TOpenDialog;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
procedure send1(host2,user2,from2,name2,to2,subject2,cc2,aname2,text2:string) ;
stdcall;export;
implementation
{$R *.DFM}
var
smtp:Tnmsmtp;
procedure send1(host2,user2,from2,name2,to2,subject2,cc2,aname2,text2:string) ;
begin
smtp:=Tnmsmtp.Create(Application);
smtp.host:=host2;
smtp.UserID:=user2;
smtp.Connect ;
smtp.PostMessage.FromAddress:=from2;
smtp.PostMessage.FromName:=name2;
smtp.PostMessage.ToAddress.Text:=to2;
smtp.PostMessage.Subject:=subject2;
smtp.PostMessage.ToCarbonCopy.Text:=cc2;
smtp.PostMessage.Attachments.text:=aname2;
smtp.PostMessage.Body.Text :=text2;
smtp.SendMail ;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
host2,user2,from2,name2,to2,subject2,cc2,aname2,text2:string;
begin
host2:=edit1.Text ;
user2:=edit2.Text ;
from2:=edit3.text;
name2:=edit4.Text ;
to2:=edit5.Text ;
subject2:=edit6.text;
cc2:=edit7.text;
aname2:=combobox1.Items.Text ;
text2:=memo1.Lines.Text ;
send1(host2,user2,from2,name2,to2,subject2,cc2,aname2,text2);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if opendialog1.Execute then
combobox1.Items.Add(opendialog1.filename);
end;
end.
转换动态连接库:
library smtpd;
uses
sharemem,
sysutils,
forms,
classes,
smtp1 in '../smtp/smtp1.pas' {Form1};
exports
send1;
begin
end.
接收邮件我用网上的sakemail控件。(delphi代的nmpop3控件接收附件时常出
问题,不知怎么截出日期)。
sakemail 的邮件接收程序调用动态连接库时也可接收邮件,关闭窗体时
和发送程序一样的错误。
我的应用程序转换动态连接库的代码:
unit pop3u2;
interface
uses
sharemem,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,sakemail;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
ComboBox1: TComboBox;
ListBox1: TListBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
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,passwd1:string;
var newmail1,mail1:integer);stdcall;export;
procedure show1(s:integer;var from1,subject1,date1,msgid1,text1,aname:string);
stdcall;export;
procedure del1(s:integer); stdcall;export;
implementation
{$R *.DFM}
var
pop:Tsakpop;
list:Tsakmsglist;
procedure create1;
begin
pop:=Tsakpop.Create(Application);
list:=Tsakmsglist.Create(Application);
end;
procedure connect1(host1,user1,passwd1:string;
var newmail1,mail1:integer);
begin
create1;
pop.Host:=host1;
pop.UserId:=user1;
pop.Passwd:=passwd1;
pop.Connect ;
if pop.POPError then
exit;
if not pop.Login then
exit;
newmail1:=pop.Init ;
mail1:=pop.MsgsCount ;
pop.RetrieveAllMessages(list);
pop.Quit ;
end;
procedure show1(s:integer;var from1,subject1,date1,msgid1,text1,aname:string);
var
i:integer;
msg:Tsakmsg;
begin
msg:=list.Items
from1:=msg.From ;
subject1:=msg.Subject ;
date1:=msg.Date ;
msgid1:=msg.MessageId ;
text1:=msg.Text.Text ;
if msg.AttachedFiles.Count >0 then
begin
for i:=0 to msg.AttachedFiles.Count-1 do
aname:=msg.AttachedFiles.FileName ;
end;
end;
procedure del1(s:integer);
begin
list.Delete(s);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
host1,user1,passwd1:string;
mail1,newmail1:integer;
{mail1,newmail1:word}
begin
host1:=edit1.Text ;
user1:=edit2.Text ;
passwd1:=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;
from1,subject1,date1,msgid1,text1,aname:string;
begin
s:=strtoint(edit6.text);
show1(s,from1,subject1,date1,msgid1,text1,aname);
edit7.text:=from1;
edit8.text:=subject1;
edit9.text:=date1;
edit10.text:=msgid1;
combobox1.Items.Clear ;
combobox1.Items.Add(aname);
//combobox1.Items.text:=aname;
listbox1.Items.Text:=text1;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
s:integer;
begin
s:=strtoint(edit6.text);
del1(s);
end;
end.
转换动态连接库:
library pop3dll;
uses
sharemem,
sysutils,
classes,
pop3u2 in '../pop32/pop3u2.pas' {Form1};
exports
connect1,
show1,
del1;
begin
end.
请您帮我解决这个问题!!!
谢谢!!!
回信请寄:fsy_2000@sina.com