求助调用DLL子窗体装入PAGECONTROL中的问题
library UDllFrom; //DLL封之
{ 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,
forms,
RzTabs,
UChildForm in 'UChildForm.pas' {Form1};
{$R *.res}
procedure AddTabSheet(FormClass: TFormClass;tbs:TRZTabSheet; rzpgc:TRZPagecontrol);
var
Form:TForm;
begin
rzpgc.ActivePage := tbs; //加上这一步算是双向指定了,指定激活页
Form := FormClass.Create(tbs); //创建Form(用TabSheet)实例
Form.Parent := tbs; //指定Form的父窗体
tbs.Caption := Form.Caption; //标题
tbs.TabVisible:=True;
Form.Show; //显示
end;
function run_form(hs:THandle;tbs:TRZTabSheet;rzpgc:TRZPagecontrol):integer;stdcall;
var
TForm1:TFormclass;
begin
Application.Handle:=hs;
AddTabSheet(TForm1,tbs,rzpgc);
end;
exports
run_form;
begin
end.
-----------------------------用DLL窗,子窗体装入主窗体中
unit UTestForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RzTabs, StdCtrls, Buttons;
type
TTestForm = class(TForm)
rzpgc: TRzPageControl;
tbs: TRzTabSheet;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
function rum_Form(hs:THandle;tbs:TRZTabSheet;rzpgc:TRZPagecontrol):Integer;stdcall;external 'UDllFrom.dll';
var
TestForm: TTestForm;
implementation
{$R *.dfm}
procedure TTestForm.BitBtn1Click(Sender: TObject);
begin
rum_Form(Application.Handle,tbs,rzpgc);
end;
end.
----------------------------
提示,法找到程序的入
[解决办法]
dll文件,TForm2为随便一个窗体
- Delphi(Pascal) code
library Project1;uses SysUtils, Classes, Controls, Forms, Windows, Unit2 in 'Unit2.pas' {Form2};{$R *.res}procedure ShowForm(app:TApplication; parent:TWinControl);stdcall;var frm : TForm2;begin frm := TForm2.Create(Application); frm.ParentWindow := parent.Handle; frm.Show; frm.Align := alClient;end;exports ShowForm name 'ShowForm';beginend.