主程序<br>function showform(AHandle: THandle; AParent: TWinControl): DWORD; stdcall;external 'project2.dll'; //显示窗体<br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.FormShow(Sender: TObject);<br>begin<br> showform(Application.Handle,Panel1);<br>end;<br><br>dll窗体<br>library Project2;<br><br>uses<br> SysUtils,<br> Classes,<br> Unit2 in 'Unit2.pas' {Form2};<br><br>{$R *.res}<br><br>exports showform;<br>begin<br>end.<br>unit Unit2;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs, StdCtrls;<br><br>type<br> TForm2 = class(TForm)<br> Edit1: TEdit;<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form2: TForm2;<br><br>function showform(AHandle: THandle; AParent: TWinControl): DWORD; stdcall; //显示窗体<br><br>implementation<br><br>{$R *.dfm}<br><br>function showform(AHandle: THandle; AParent: TWinControl): DWORD; stdcall; //显示窗体<br>var<br> aform: TForm2;<br>begin<br> Application.Handle := AHandle;<br> AForm := TForm2.Create(Application);<br> try<br> Form2 := AForm;<br> if Assigned(AParent) then<br> begin<br> AForm.BorderStyle := bsSizeable;<br> SetParent(AForm.Handle,AParent.Handle);<br> end;<br> AForm.Show;<br> finally<br><br> end;<br>end;<br><br>end.<br><br>没有遇到你说的问题<br>偶刚刚开发完成的项目中全部都是由dll窗体构成的,没有遇到楼主的情况,楼主运气不好