DLL原码:
library Msg;
uses
SysUtils,
Dialogs,
Classes;{$R *.res}Procedure MsgDlg(Fmsg: string);stdcall;
Begin
showmessage(Fmsg);
End;Exports
MsgDlg;begin
end.=========================================================================
调用的原码:
unit Test;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
Procedure MsgDlg(Fmsg:string);stdcall;External 'msg.dll';
{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
MsgDlg('xxxxxx');
end;end.
=============================================================================
生成了Msg.dll但是注册时出现下列错误提示。请帮忙改一改,谢谢~
E:\MyDocument\soft\Dll\Msg.dll was loaded, but the DllRegisterServer entry point was not found.DllRegisterServer may not be exported, or a corrupt version of E:\MyDocument\soft\Dll\Msg.dll may be in memory. Consider using PView to detect and remove it.
library Msg;
uses
SysUtils,
Dialogs,
Classes;{$R *.res}Procedure MsgDlg(Fmsg: string);stdcall;
Begin
showmessage(Fmsg);
End;Exports
MsgDlg;begin
end.=========================================================================
调用的原码:
unit Test;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
Procedure MsgDlg(Fmsg:string);stdcall;External 'msg.dll';
{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
MsgDlg('xxxxxx');
end;end.
=============================================================================
生成了Msg.dll但是注册时出现下列错误提示。请帮忙改一改,谢谢~
E:\MyDocument\soft\Dll\Msg.dll was loaded, but the DllRegisterServer entry point was not found.DllRegisterServer may not be exported, or a corrupt version of E:\MyDocument\soft\Dll\Msg.dll may be in memory. Consider using PView to detect and remove it.
注册语句:regsvr32 E:\MyDocument\soft\Dll\Msg.dll
可以注册的dll都是进程内的com服务器或者是ActiveX控件(只不过扩展名是dll而不是ocx)。
你为什么要注册?