ÊÖ»úÕ¾
ÍøÍ¨·ÖÕ¾
µçÐÅÖ÷Õ¾
ÃÜ¡¡Âë:
Óû§Ãû£º
µ±Ç°Î»Öà : Ö÷Ò³>³ÌÐòÉè¼Æ>delphi>Áбí

¶¯Ì¬¼ÓÔØºÍ¶¯Ì¬×¢²áÀ༼ÊõµÄÉîÈë̽Ë÷

À´Ô´£º»¥ÁªÍø ×÷ÕߣºÎ÷²¿ÊýÂë ʱ¼ä£º2008-04-09
Î÷²¿ÊýÂë-È«¹úÐéÄâÖ÷»ú10Ç¿£¡40ÓàÏîÐéÄâÖ÷»ú¹ÜÀí¹¦ÄÜ,È«¹úÁìÏÈ!Ë«Ïß¶àÏßÐéÄâÖ÷»úÄϱ±·ÃÎʳ©Í¨ÎÞ×è!Ãâ·ÑÔùËÍÆóÒµÓʾÖ,.CNÓòÃû,×ÔÖú½¨Õ¾480ÔªÆð,Ãâ·ÑÊÔÓÃ7Ìì,ÂúÒâÔÙ¸¶¿î! P4Ö÷»ú×âÓÃ799Ôª/ÔÂ.Ô¸¶Ãâѹ½ð!

{ *********************************************************************** }
unit Unit1;

interface

uses
UnitPackageInfo,
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;

type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Panel1: TPanel;
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
OpenDialog1: TOpenDialog;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
FPack: TPackage;
procedure FreePack;
public
{ Public declarations }
end;

var
Form1 : TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
I : Integer;
begin
if OpenDialog1.Execute then
begin
FreePack;
FPack := TPackage.Create(OpenDialog1.FileName);
FPack.RegClassInPackage;
end;
ListBox1.Items.Clear;
for i := 0 to FPack.IDEInfoCount - 1 do
begin
ListBox1.Items.Add(FPack.IDEInfo[I].iClass.ClassName);
end;
Memo1.Lines.Clear;
Memo1.Lines.Add(''''------ContainsUnitList:-------'''');
for i := 0 to FPack.ContainsUnit.Count - 1 do
begin
Memo1.Lines.Add(FPack.ContainsUnit[I]);
end;
Memo1.Lines.Add(''''------DcpBpiNameList:-------'''');
for i := 0 to FPack.DcpBpiName.Count - 1 do
begin
Memo1.Lines.Add(FPack.DcpBpiName[I]);
end;
Memo1.Lines.Add(''''--------RequiresPackageList:---------'''');
for i := 0 to FPack.RequiresPackage.Count - 1 do
begin
Memo1.Lines.Add(FPack.RequiresPackage[I]);
end;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FreePack;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
Ctrl : TControl;
begin
if (ListBox1.ItemIndex <> -1) and (FPack <> nil) then
begin //ÅжÏÈç¹û²»ÊÇTControlµÄ×ÓÀà´´½¨ÁËÒ²¿´²»¼û£¬¾Í²»´´½¨ÁË
if (FPack.IDEInfo[ListBox1.ItemIndex].iClass.InheritsFrom(TControl)) then
begin
Ctrl := nil;
try
Ctrl := TControl(FPack.IDEInfo[ListBox1.ItemIndex].iClass.Create(Self));
Ctrl.Parent := Panel1;
Ctrl.SetBounds(0, 0, 100, 100);
Ctrl.Visible := True;
except

end;
end;
end;
end;

procedure TForm1.FreePack;
var
I : Integer;
begin
for i := Panel1.ControlCount - 1 downto 0 do
Panel1.Controls[i].Free;
FreeAndNil(FPack);
end;

end.
´°ÌåÎļþÈçÏ£º
object Form1: TForm1
Left = 87
Top = 120
Width = 518
Height = 375
Caption = ''''Form1''''
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = ''''MS Sans Serif''''
Font.Style = []
OldCreateOrder = False
OnClose = FormClose
PixelsPerInch = 96
TextHeight = 13
object GroupBox1: TGroupBox
Left = 270
Top = 0
Width = 240
Height = 224
Align = alRight
Caption = ''''Àà''''
TabOrder = 0
object ListBox1: TListBox
Left = 2
Top = 15
Width = 236
Height = 207
Align = alClient
ItemHeight = 13
TabOrder = 0
end
end
object Panel1: TPanel
Left = 0
Top = 224
Width = 510
Height = 124
Align = alBottom
Color = clCream
TabOrder = 1
end
object Button1: TButton
Left = 8
Top = 8
Width = 249
Height = 25
Caption = ''''ÔØÈë°ü''''
TabOrder = 2
OnClick = Button1Click
end
object Button2: TButton
Left = 8
Top = 40
Width = 249
Height = 25
Caption = ''''´´½¨ËùÑ¡ÖеÄÀàµÄʵÀýÔÚPanelÉÏ''''
TabOrder = 3
OnClick = Button2Click
end
object Memo1: TMemo
Left = 8
Top = 72
Width = 257
Height = 145
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 4
end
object OpenDialog1: TOpenDialog
Filter = ''''*.BPL|*.BPL''''
Left = 200
Top = 16
end
end
ÔÚÕâЩ»ù´¡ÉÏÎÒÃÇÍêÈ«¿ÉÒÔ½¨Á¢Ò»¸ö×Ô¼ºµÄDelphiµÄIDE£¬¶ÔÏóµÄÊôÐԵĻñµÃºÍÉèÖÃÓÃTYPInfoµ¥ÔªµÄRTTIÀຯÊýÍêÈ«¿ÉÒÔÇáËɸ㶨£¬ÎҾͲ»ÔÚÕâÀï¶à·Ñ¿ÚÉàÁË¡£
¼ÇסÁË£¬±àÒëʱһ¶¨ÒªÓÃЯ´øVCL.BPL °üµÄ·½Ê½.

ÎÄÕÂÕûÀí£ºÎ÷²¿ÊýÂë--רҵÌṩÓòÃû×¢²á¡¢ÐéÄâÖ÷»ú·þÎñ
http://www.west263.com
ÒÔÉÏÐÅÏ¢ÓëÎÄÕÂÕýÎÄÊDz»¿É·Ö¸îµÄÒ»²¿·Ö,Èç¹ûÄúÒª×ªÔØ±¾ÎÄÕÂ,Çë±£ÁôÒÔÉÏÐÅÏ¢£¬Ð»Ð»!