先新建一个Dll的项目,然后把你的窗体单元加进来,把调用窗体的函数输出即可。

解决方案 »

  1.   

    D5DG的例子:
    DLLFrm.pas
    {
    Copyright ?1999 by Delphi 5 Developer's Guide - Xavier Pacheco and Steve Teixeira
    }unit DLLFrm;interfaceuses
      SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
      Forms, Dialogs, Grids, Calendar;type  TDLLForm = class(TForm)
        calDllCalendar: TCalendar;
        procedure calDllCalendarDblClick(Sender: TObject);
      end;{ Declare the export function }
    function ShowCalendar(AHandle: THandle; ACaption: String): TDateTime; StdCall;implementation
    {$R *.DFM}function ShowCalendar(AHandle: THandle; ACaption: String): TDateTime;
    var
      DLLForm: TDllForm;
    begin
      // Copy application handle to DLL's TApplication object
      Application.Handle := AHandle;
      DLLForm := TDLLForm.Create(Application); 
      try
        DLLForm.Caption := ACaption;
        DLLForm.ShowModal;
        Result := DLLForm.calDLLCalendar.CalendarDate; // Pass the date back in Result
      finally
        DLLForm.Free;
      end;
    end;procedure TDLLForm.calDllCalendarDblClick(Sender: TObject);
    begin
      Close;
    end;end.CalendarLib.dprlibrary CalendarLib;uses
      ShareMem,
      SysUtils,
      Classes,
      DLLFrm in 'DLLFrm.pas' {DLLForm};exports
      ShowCalendar;
      
    begin
    end.