惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

月光博客
月光博客
雷峰网
雷峰网
S
SegmentFault 最新的问题
博客园 - 【当耐特】
博客园_首页
量子位
爱范儿
爱范儿
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
V
V2EX
美团技术团队
V
Visual Studio Blog
博客园 - 三生石上(FineUI控件)
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
博客园 - 聂微东
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
宝玉的分享
宝玉的分享
WordPress大学
WordPress大学
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - DELPHI技术

How to get File Summary Info 动态建表(示例) DBGridEh应用实例(来自delphi园地) DBGrid、DBGrideh专题总结(来自delphi园地) delphi 默认情况下参数及返回值的保存位置 Rotating Text How to Parse a Delimited String Into a String List - DELPHI技术 2005年5月20日Borland Delphi首席科学家Danny Thorpe谈Delphi的未来! 使用动态包导出函数的调用单元完整源代码 使用动态包导出函数的单元的完整源代码 “类引用”概念 创建包 包和DLL的对比 动态包(bpl)的一个窗体源代码 动态调用包(bpl)的窗体源码 Delphi中预想不到的代码 一个完整身份证效验程序 基本算法(用 PASCAL 描述) 公用函数
什么是BPL?在BPL中有多少单元的源代码
DELPHI技术 · 2005-07-16 · via 博客园 - DELPHI技术

DFM File(main.dfm):

object MainForm: TMainForm
  Left = 301
  Top = 163
  Width = 696
  Height = 480
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -16
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 19
  object TreeView: TTreeView
    Left = 0
    Top = 0
    Width = 688
    Height = 453
    Align = alClient
    Indent = 19
    TabOrder = 0
    Items.Data = {
      010000001C0000000000000000000000FFFFFFFFFFFFFFFF0000000000000000
      0342504C}
  end
end

PAS File(main.pas):

unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, StrUtils, TypInfo;

type
  TMainForm = class(TForm)
    TreeView: TTreeView;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  MainForm: TMainForm;

implementation

{$R *.dfm}

//==============================================================================
//Form.Unit*****************************************************************
//==============================================================================
procedure EnumPackageInfo(const InfoName: string; NameType: TNameType; Flags: Byte; Param: Pointer);
var Node: TTreeNode;
    i: integer;
begin
  Node := nil;
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  with MainForm.TreeView do
  begin
    for i:=1 to Selected.Count do
    if Selected.Item[i-1].Text=GetEnumName(TypeInfo(TNameType), Ord(NameType))
    then Node := Selected.Item[i-1];
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    if not Assigned(Node)
    then Node := Items.AddChild(Selected, GetEnumName(TypeInfo(TNameType), Ord(NameType)));
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Items.AddChild(Node, InfoName);
  end;
end;

//==============================================================================
//Form.´´½¨´°Ìå*****************************************************************
//==============================================================================
procedure TMainForm.FormCreate(Sender: TObject);
var SystPath: array[0..128] of char;
    DosError: Integer;
    DirInfo: TSearchRec;
    AppName: string;
    HPack: HModule;
    Flags: Integer;
    Desc: string;
begin
  GetSystemDirectory(SystPath, 128);
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  DosError := FindFirst(SystPath+'\*.*', FaAnyfile, DirInfo);
  while DosError=0 do
  begin
    {$IF DEFINED(WIN32) AND DECLARED(UsingVCL)}
    if ((DirInfo.Attr and FaDirectory)<>FaDirectory) and ((DirInfo.Attr and FaVolumeID)<>FaVolumeID)
    {$ELSE}
    if ((DirInfo.Attr and FaDirectory)<>FaDirectory)
    {$IFEND}
    then if UpperCase(Copy(DirInfo.Name,Pos('.',DirInfo.Name)+1,3))='BPL' then
         try
           Desc := GetPackageDescription(PChar(DirInfo.Name));
           if Desc<>'' then Desc := '......('+ Desc +')';
           TreeView.Items.AddChild(TreeView.Items[0], DirInfo.Name + Desc);
           TreeView.Items[0].Item[TreeView.Items[0].Count-1].Selected := True;
           HPack := LoadPackage(DirInfo.Name);
           GetPackageInfo(HPack, Pointer(@HPack), Flags, EnumPackageInfo);
         except
         end;
    DosError := FindNext(DirInfo);
  end;
  SysUtils.FindClose(DirInfo);
  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  AppName := ExtractFileName(Application.ExeName);
  TreeView.SaveToFile(ExtractFilePath(Application.ExeName)+Copy(AppName,1,Pos('.',AppName)-1)+'.txt');
end;

end.