主程序exe文件分为了几个模块,每个模块分别调用不同的dll,有下面两个文件解决不了啊,请大家帮帮忙,想想~~
1。主程序,如何把参数传给dll?并且dll如何把结果,如一个变量的值返回给主程序?
2。主程序已经有一个adoconnection,连接了数据库,dll怎样继续使用主程序的那个数据库连接?还有这个主程序是一个三层结构的客户端,使用了一个tcpconnect,连接到远程provider,这个dll怎么继续使用这个连接呢
1。主程序,如何把参数传给dll?并且dll如何把结果,如一个变量的值返回给主程序?
2。主程序已经有一个adoconnection,连接了数据库,dll怎样继续使用主程序的那个数据库连接?还有这个主程序是一个三层结构的客户端,使用了一个tcpconnect,连接到远程provider,这个dll怎么继续使用这个连接呢
解决方案 »
- 类型抽象的问题...麻烦指点下,卡壳了....-_-!
- 如何将exe文件集到Delphi环境中?
- 想设计这么一个程序:当我在图形界面下,双点其中的各个文本框,下拉框时,框中的内容能被自动复制到指定的文本文件中?
- 用dspack开发遇到一个问题,怎么能够在VideoWindow中选定范围后然后抓取图象
- 想找个对delphi数据库操作熟练的人交流和学习。
- 关于复合查询的问题
- 关于SQL SEREVER2000在局域网内部连接的问题!
- XE7开发的,部署手机取服务端数据,一直报错
- delphi 动态增加sql数据库中字段后,如何动态删除?要快哦!
- 使用OpenCV查看IP摄像机视频的问题,大神请进
- 有哪位给ehlib DBgridEH加了“分组显示”的工能了吗?
- 多数据库查询统计、分析的问题
传入adoconnection:DLL:
library prjDLL;{ 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,
Forms,
Windows,
Messages,
Classes,
DLLFormUnit in 'DLLFormUnit.pas' {frmDLLForm},
AboutUnit in 'AboutUnit.pas' {frmAbout};{$R *.res}var
DLLApp: TApplication;
//DLLScr: TScreen;
procedure CreateDLLForm(App: TApplication; AC: Tadoconnection);
var
ptr:PLongInt;
begin
Application := App;
///Screen := Scr;
Application.CreateForm(TfrmDLLForm, frmDLLForm);
TfrmDLLForm.Tadoconnection1=AC;
//Application.CreateForm(TfrmAbout, frmAbout);
result:=frmDLLForm;
end;procedure ExitDLL(Reason: Integer);
begin
if Reason = DLL_PROCESS_DETACH then
begin
Application := DLLApp;
//Screen := DLLScr;
end;
end;
exports
CreateDLLForm;begin
DLLApp := Application;
//DLLScr := Screen;
DLLProc := @ExitDLL;end.主程序:procedure TfrmMain.mi_inDLLClick(Sender: TObject);
type
InvokeDLLForm=procedure (App: TApplication; AC: Tadoconnection)
var
DLLHandle: THandle;
DLLSub: InvokeDLLForm;begin
DLLHandle := LoadLibrary('prjDLL.dll');
if DLLHandle <> 0 then
begin
@DLLSub := GetProcAddress(DLLHandle, 'CreateDLLForm');
if Assigned(DLLSub) then
begin
DLLForm := DLLSub(Application, adoconnection1);
end;
end;
end;
可能你说的是多种数据交换,在这种情况下,效率最高的是使用内存映像文件,较麻烦,可查相关资料。