Dll中导出类--Delphi实战之一(4)

2008-04-09 04:29:29来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

我们设计了以下两个导出函数:

1. function GetClassCount: integer; stdcall;

告诉调用者,本Dll中共有几个子类;

2function GetClassTypeByIndex(const iIndex: integer;

var ClassType: MyBaseFormClass): WordBool; stdcall;

以索引方式获得具体的子类。注意,此处的ClassType的类型是MyBaseFormClass,这表明,它的值将是一个确定的自TMyBaseForm继承而来的类。

以下是它们可能的一种实现:

function GetClassCount: integer;

begin

result := 3; //表明本Dll中导出了3个类

end;

function GetClassTypeByIndex(const iIndex: integer;

var ClassType: MyBaseFormClass): WordBool;

begin

result := True;

case iIndex of

0: ClassType := TFrmTest1;

1: ClassType := TFrmTest2;

2: ClassType := TFrmTest3;

else

result := False;

end;

end;

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:怎样屏蔽或打开windows里的快捷键

下一篇:设计模式、用Delphi实现---->Decorator 模式