主程序是一个EXE文件,其余全是DLL文件,采用动态载入的方式.
我要的效果如下:
打开A(EXE文件)显示B(包含窗体的DLL文件),再从B处打C(包含窗体的DLL文件),然后从C回调参数给B.请问高手们这个如何做.
理论的东西不要回了(可怕的复制),最好有例程.

解决方案 »

  1.   

    建议去看看DLL里的知识 其实DLL加载后也是加载到内存中  就开你公布的DLL函数了  另外  所有FORM在DLL中也只是个指针
    所以 传入的时候可以用@FORM   其他的都是变量问题了 ~~ 对了  其实函数也可以用@+函数名的  这就是回调函数  
      
      

  2.   

    不要理论……呵呵,那我还能说什么?
    就告诉你一下,你只要把 TApplication 从 A 传到 B,从B传到C,
    参数,都用 var (甚至用 参数用procedure 或者 function)
    没有不能搞头d
      

  3.   


    这个问题很好啊,需考虑的安全问题很多,
    主要是获取Application.Handle的问题,
    还有dll窗体关闭时释放问题,
    我也试过,但没解决,还得请高手们解决.
      

  4.   

    闲时无事,自己根据楼主的需求实现了。
    大概思路是,窗体之间调用如楼上各位所说,通过传递TApplication。
    如下是B窗体中的代码,可做参考library ProjectC;{ 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,
      Windows,
      Forms,
      UnitC in 'UnitC.pas' {FormC};{$R *.res}
    var
      DllApp: TApplication;
      
    function ShowCForm(App: TApplication): Boolean; stdcall;
    begin
      Application :=App;{获取调用窗体的Application,显而易见的功能是 能使你的窗体融合到调用程序中。通过它还能进行很多操作}
      Formc:= TFormc.Create(App);
      FormC.Show;
    end;procedure GetParam(var Value: string); stdcall; {通过函数的方式,返回C窗体中的Param得到}
    begin
      Value:= FormC.Param;{Param在FormC中定义为全局变量}
    end;procedure UnLoadForm(Reason: Integer); register;
    begin
      {DLL取消调用时,发送DLL_PROCESS_DETACH消息,此时将DLL的Application返回为本身}
      if Reason = DLL_PROCESS_DETACH then Application:=DLLApp;
    end;exports
      ShowCForm,
      GetParam;begin
      DLLApp:=Application;{初始化时保存DLL本身Application,以便DLL取消时返回}
      DLLProc := @UnLoadForm;
    end.
      

  5.   

    纠正:上面是C窗体的代码,B窗体调用都相同。
    {ps:CSDN不可以编辑帖子?}