如何解决Delphi6 代码:一个简单的 hello world 应用程序,调用了 form2.bpl 却碰壁了
我正在尝试让这个主应用调用我的 .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 举报,一经查实,本站将立刻删除。