//调用DLL的文件
unit main;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;
TShowF1=function(AHandle:THandle):String;StdCall;
var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
HDLL:THandle;
ProcAddr: TShowF1;
begin
HDLL:=LoadLibrary('DLL.dll');
if HDLL<32 then exit;
@ProcAddr:=GetProcAddress(HDLL,'ShowF1');
procAddr(Application.Handle);
FreeLibrary(HDLL);
end;end.
//dll文件
library DLL;uses
SysUtils,
Classes,
DLLF in 'DLLF.pas' {DLLFrm};
exports
ShowF1;
begin
end.
//////////////////////
unit DLLF;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TDLLFrm = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;var
DLLFrm: TDLLFrm;
function ShowF1(AHandle:THandle):String;StdCall;implementation
function ShowF1(AHandle:THandle):String;stdcall;//
var
DLLF: TDLLFrm;
begin
//Application.Handle:=AHandle;
DLLF:=TDLLFrm.Create(Application);
try
if DLLF.ShowModal=mrok then//改
result:='dllopen';//改
finally
DLLF.Free;
end;
end;end.
////
出现的问题是:
Exception:EResNotFound in Module DLL.dll at000318C4
unit main;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;
TShowF1=function(AHandle:THandle):String;StdCall;
var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
HDLL:THandle;
ProcAddr: TShowF1;
begin
HDLL:=LoadLibrary('DLL.dll');
if HDLL<32 then exit;
@ProcAddr:=GetProcAddress(HDLL,'ShowF1');
procAddr(Application.Handle);
FreeLibrary(HDLL);
end;end.
//dll文件
library DLL;uses
SysUtils,
Classes,
DLLF in 'DLLF.pas' {DLLFrm};
exports
ShowF1;
begin
end.
//////////////////////
unit DLLF;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TDLLFrm = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;var
DLLFrm: TDLLFrm;
function ShowF1(AHandle:THandle):String;StdCall;implementation
function ShowF1(AHandle:THandle):String;stdcall;//
var
DLLF: TDLLFrm;
begin
//Application.Handle:=AHandle;
DLLF:=TDLLFrm.Create(Application);
try
if DLLF.ShowModal=mrok then//改
result:='dllopen';//改
finally
DLLF.Free;
end;
end;end.
////
出现的问题是:
Exception:EResNotFound in Module DLL.dll at000318C4
解决方案 »
- 这样理解是否正确:UDP可以是Client或者Server广播,但接收者只能是Server?
- 什么叫诬蔑!请大家看清hemiya真面目!
- 分页控制?
- 问问 哪里有免费的这样的东西 给我用用 急!!!本人就20 分了 在线
- 请问如何快速建立报表?
- 九局下半(人生就像一场棒球比赛)
- 超菜,超simple的问题,不要笑偶 ,>>>>>>>><<<<<<<<<
- delphi exe文件图标不能改变
- 我用ClientSocket和ServerSocket做了一个通讯程序,在局域网能连通,在Internet就不行了,为什么?
- getfocus()
- delphi7的序列号是多少?
- JPG(JPEG)的文件的图片如何旋转
加到implementation后面就可以了!!!另外你的DLL中没有对Application对象初始化,不应该屏蔽Application.Handle:=AHandle;这句话!!!