当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: Delphi的包是Delphi IDE的核心技术,没有包也就没有了Delphi的可视化编程。
 

 

    摘要: 新开一个project,然后拖两个button放在窗体上代码如下:unit unit1; interface uses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; type tform1 = class(tform) btnaddbutton: t......
    摘要: uses commctrl; var oldwindowproc: twndmethod; procedure tform1.mywindowproc(var msg: tmessage);begin if msg.msg = cn_notify then begin case twmnotify(msg).nmhdr.code of mcn_getdaystate: memo1.lines......


动态加载和动态注册类技术的深入探索
上一页   ...    registerclass(componentclasses[i]);

  end; 【程序编程相关:自己编写树(Tree)的封装类

【推荐阅读:为Windows Service添加服务

end; 【扩展信息:报名机器人

然后一条语句registercomponentsproc:= @myregcomponentsproc;似乎就解决问题了.

慢着!registercomponentsproc是在classes单元.但是bpl中的classes单元是在另一个运行时的包vcl.bpl里面.而我们工程所修改的registercomponentsproc的指针是编译在我们的工程中,空间是不同的.所以我们的工程一定要编译成带运行时包vcl.bpl的才行.但是这样一来的话我们也就只能载入与我们所用的编译器相同版本编译器编译出来的bpl文件了,也就是说delphi6只能载入delphi6或者bcb6编译出来的bpl文件以此类推.

但是还有一个问题没有解决,那就是如何知道一个包中到底有那些各单元呢?可以通过getpackageinfo过程来获得.

我已经把加载包的过程封装到了一个类中.整个程序的代码如下:

{ *********************************************************************** }

{                                                                         }

{ 动态加载package的类                                                     }

{                                                                         }

{ wr960204(王锐)2003-2-20                                                 }

{                                                                         }

{ *********************************************************************** }

unit unitpackageinfo;

interface

uses

  windows, messages, sysutils, variants, classes, graphics, controls, forms,

  dialogs, stdctrls;

type

  pideinfo = ^tideinfo;

  tideinfo = record

    iclass: tcomponentclass;


...   下一页
 ·delphi 9 一点体验    »显示摘要«
    摘要: 1.支持c#、delphi for .net、delphi for win32 2.code snippets 3.for loop(支持delphi for win32) 4.refactoring for delphi and c#(***) 5.error inside 6.help inside提示信息中的链接(***) 7.history view(****) 对于f......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE