程序中要动态调用自编的bpl包,如何获得其中注册的单元?
解决方案 »
- SQL语句
- 小儿科的问题。。
- 想用ExpressQuantumTreeList 4等网格编辑控件对BLob,IMage类型的列进行编辑,但在delphi6或delphi7中都会出错,哪位邦忙
- 请问#$d是什么意思?
- 进来都有100分,都解答者+200分. 争钱容易,争分难,省时省力.>>>
- midas中的事务控制
- 关于数据库的小问题
- 下一步该学什么,或者说该从事什么?
- 在treeview中,右键不能得到当前右键所选择selected的属性,高分
- 局域网中做了个BBS,想以附件的形式添加word文档的方法有吗?
- 请教:我有一个 button1 按钮,我想把 u 设为热键,要怎么设置 啊?谢谢!
- 主窗体onshow时判断其他窗体的查询问题!
function GetPackageClass(AClassName: String): TPersistentClass;然后再由主exe去调用。不过去年看过一个帖子,好像加几句汇编代码就可以了,不过现在忘了。
Enumerates all the units and required packages for a package.
[Delphi] procedure GetPackageInfo(Module: Cardinal, Param: Pointer, var Flags: Integer, InfoProc: TPackageInfoProc);
Description
Call GetPackageInfo to process the information in a package's information table. The InfoProc callback is called for every unit included in the package and for every package required by the package. Module is the module handle for the package. GetPackageInfo passes any application-supplied information passed in the Param parameter to the InfoProc callback. The package's information flags are passed to the InfoProc and returned in the Flags parameter.
NameType: TNameType; Flags: Byte; Param: Pointer);
var
FlagStr: string;
begin
FlagStr := ' ';
if Flags and ufMainUnit <> 0 then
FlagStr := FlagStr + 'Main Unit ';
if Flags and ufPackageUnit <> 0 then
FlagStr := FlagStr + 'Package Unit ';
if Flags and ufWeakUnit <> 0 then
FlagStr := FlagStr + 'Weak Unit ';
if FlagStr <> ' ' then
FlagStr := ' (' + FlagStr + ')';
with Form1.TreeView1.Items do
case NameType of
ntContainsUnit:
AddChild (ContNode, Name + FlagStr);
ntRequiresPackage:
AddChild (ReqNode, Name);
end;
end;function ForEachModule (HInstance: Longint;
Data: Pointer): Boolean;
var
Flags: Integer;
ModuleName, ModuleDesc: string;
ModuleNode: TTreeNode;
begin
with Form1.TreeView1.Items do
begin
SetLength (ModuleName, 200);
GetModuleFileName (HInstance,
PChar (ModuleName), Length (ModuleName));
ModuleName := PChar (ModuleName); // fixup
ModuleNode := Add (nil, ModuleName); // get description and add fixed nodes
ModuleDesc := GetPackageDescription (PChar (ModuleName));
ContNode := AddChild (ModuleNode, 'Contains');
ReqNode := AddChild (ModuleNode, 'Requires'); // add information if the module is a package
GetPackageInfo (HInstance, nil,
Flags, ShowInfoProc);
if ModuleDesc <> '' then
begin
AddChild (ModuleNode,
'Description: ' + ModuleDesc);
if Flags and pfDesignOnly = pfDesignOnly then
AddChild (ModuleNode, 'Design Only');
if Flags and pfRunOnly = pfRunOnly then
AddChild (ModuleNode, 'Run Only');
end;
end;
Result := True;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
EnumModules(ForEachModule, nil);
end;http://www.marcocantu.com/code/md6htm/PackInfo.htm
Classes.RegisterComponentsProc := @RegComponentsProc;
应该是可行的。