T
taizhi
Unregistered / Unconfirmed
GUEST, unregistred user!
有一DLL代码如下:<br>library DLL1;<br>uses<br> SysUtils,<br> Classes;<br><br>type<br> TCB1=function (x:Integer):Integer;stdcall;<br><br>{$R *.res}<br><br>function CBDll1(InitValue:Integer;TCB:TCB1):Integer;stdcall;<br>var<br> i:Integer;<br>begin<br> for i:=1 to 100 do<br> begin<br> Inc(InitValue);<br> TCB(InitValue);<br> end;<br> Result:=InitValue;<br>end;<br><br>exports<br> CBDll1;<br><br>begin<br>end.<br><br>有一EXE代码如下:<br>unit Main;<br>interface<br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls, Buttons;<br>type<br> TCB1=function (x:Integer):Integer; <br><br> TForm1 = class(TForm)<br> Button1: TButton;<br> Memo1: TMemo;<br> BitBtn1: TBitBtn;<br> Memo2: TMemo;<br> procedure Button1Click(Sender: TObject);<br> procedure BitBtn1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>function abc(x:Integer):Integer;stdcall;<br>var<br> Form1: TForm1;<br><br>implementation<br><br>function CBDll1(InitValue:Integer;TCB:TCB1):Integer;stdcall;external 'Dll1.dll';<br><br>{$R *.dfm}<br><br>function abc(x:Integer):Integer;stdcall;<br>begin<br> Form1.Memo1.Lines.Add(Inttostr(x));<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> Memo1.Lines.Clear;<br> CBDll1(1,@abc);<br>end;<br>end.<br>我现在用EXE直接调用DLL中的回调函数没有问题,我想在想做到的是,我想把调用DLL1的代码写到DLL2(也是一DLL文件)中,通过调用DLL2来调用DLL1,并且能把结果显示在EXE文件中的MEMO2中,效果要与直接调用DLL1一样,即能获取到每个变化值.这种问题如何解决?