问题描述
我正在尝试让这个主应用调用我的 .bpl
,但不确定为什么我不能让它工作。
当我尝试查找对象或将其添加到我的 uses
时,我找不到它。
主要目标是使用 .bpl
并调用它。我想,您可以在 IDE 中执行一些操作,将文件添加或链接在一起,但不确定这是否有效,因为它无法在如下所示的代码中调用。
unit Home;
interface
uses
Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms, Dialogs,StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
dialog : TFindDialog; //<---
myDBForm : TDBForm; // undeclared identifier 'DBForm'
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
HandlePack: HModule;
begin
HandlePack := LoadPackage('L:\Program Files\Borland\Delphi6\Projects\PKG_FORM\DB_Form_PKG.bpl');
Label1.Caption := 'LoadedPackage';
if HandlePack > 0 then
begin
// don't really want a dialog... want to load my special .bpl form
// not sure how... missing how to add the .bpl to my uses
// how do you add it to the uses statement?
dialog := TFindDialog.Create(Application);
// myDBForm := TDBForm.Create(Application); <-- would rather use this form but it wont work
if Assigned (dialog) then //<--- same as above... if I can use my form replace here
begin
if dialog.Execute then //<--- same again replace with DBForm once it works.
try
finally
end;
end
else
ShowMessage ('Form class not found');
UnloadPackage (HandlePack);
end
else
ShowMessage ('Package not found');
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
//dialog.Free;
Application.Terminate;
end;
end.
unit DBForm;
interface
uses
Windows,StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)