delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
500 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (0)


BPL AnalyzeFormat this article printer-friendly!Bookmark function is only available for registered users!
Product:
Delphi all versions
Category:
Object Pascal
Skill Level:
Scoring:
Last Update:
02/12/2003
Search Keys:
delphi delphi3000 article borland vcl code-snippet BPL
Times Scored:
1
Visits:
2066
Uploader: quark quark
Company:
Reference: N/A
 
Question/Problem/Abstract:
What in BPL? How many Units in BPL?
Answer:



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.








Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment













 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
I. Siticov
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)