library Project1;{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }uses
SysUtils,
Classes,
forms,
Unit1 in 'Unit1.pas' {Form1};{$R *.res}
procedure LoadFormxp(AppHandle:THandle);stdcall;
begin
Application.Handle:=AppHandle;
Form1:=TForm1.Create(Application);
Form1.Show;
end;procedure UnFormxp();stdcall;
begin
if Assigned(Form1) then
FreeAndNil(Form1);
end;
exports
LoadFormxp,
UnFormxp;begin
end.
请大家帮助,怎样动态调用DLL?
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }uses
SysUtils,
Classes,
forms,
Unit1 in 'Unit1.pas' {Form1};{$R *.res}
procedure LoadFormxp(AppHandle:THandle);stdcall;
begin
Application.Handle:=AppHandle;
Form1:=TForm1.Create(Application);
Form1.Show;
end;procedure UnFormxp();stdcall;
begin
if Assigned(Form1) then
FreeAndNil(Form1);
end;
exports
LoadFormxp,
UnFormxp;begin
end.
请大家帮助,怎样动态调用DLL?
解决方案 »
- datasnap里如何使用insert into,delete等sql语句?
- Richedit 读取rtf文件,,,,
- 我已经在form.creat事件里面打开了ttable控件,并设置了table1.edit了,后面只要我写数据怎么还要我table1.edit?
- WebService的问题?急!
- 关于重新装系统后delphi 5 不能编译的问题
- 怎样监视注册表的变化,怎样监视文件的变化
- 各位高手,怎样做出Foxmail中邮件列表框的效果?
- BDE代码转换ADO代码(在线等待)
- 在tabsheet上为什么看不到动态添加的webbrowser控件?
- 如何判断IE已经运行?(特急)
- 关于提示信息的问题?
- 有谁用过三方的DBGridEH吗?如何把Footer(脚注)调高
procedure test;
const
ADllName='D:\dll\Project2.dll';
AProcName='DoTest';
var
Lib:Integer;
AProc:procedure (H: THandle;AConn: TADOConnection); cdecl;
begin
try
Lib:=LoadLibrary(PChar(ADllName));
if Lib<>0 then
try
AProc:=GetProcAddress(Lib,PChar(AProcName));
if @AProc=nil then
begin
MessageBox(Handle,Format('动态链接库"%s"中找不到过程"%s"的入口地址!',[ADllName,AProcName]),'错误','MB_ICONERROR);
Exit;
end;
AProc(Application.Handle,ADOConnection1);
finally
FreeLibrary(Lib);
end else
MessageBox(Handle,Format('找不到动态链接库"%s"',[ADllName]),'错误',MB_ICONERROR);
except
on E:Exception do
MessageBox(Handle,PChar('不明错误!错误信息为:'+E.Message),'错误',MB_ICONERROR);
end;
end;
LoadLibrary()
GetProcAddress()
FreeLibrary()