[英]ActiveX installation in Delphi 7.0
I am using an ActiveX component in my projects. 我在项目中使用ActiveX组件。 I can add this component to Visual Studio 2010, 2008, Delphi XE2, Visual Basic 6.0, but I cannot import this into Delphi versions 5, 6 or 7.
我可以将此组件添加到Visual Studio 2010、2008,Delphi XE2,Visual Basic 6.0中,但不能将其导入到Delphi 5、6或7版本中。
This is the activex file in my ftp server: Active X File 这是我的ftp服务器中的activex文件: Active X文件
OK, I was brave enough to download and register this OCX and try to replicate what you did. 好的,我很勇敢地下载并注册了此OCX,并尝试复制您所做的事情。 And yes I found the same behaviour as your reported.
是的,我发现与您报告的行为相同。
So, I looked at the imported type library unit in XE2. 因此,我看了XE2中导入的类型库单元。 Remember that in XE2 a component appears on the palette.
请记住,在XE2中,组件会出现在面板上。 At the bottom of the unit is this code:
该单元的底部是以下代码:
procedure Register;
begin
RegisterComponents(dtlOcxPage, [TTAK_Control]);
end;
This code registers the component in the palette and it is missing when the OCX is imported in Delphi 6, the only old Delphi I have to hand. 这段代码将组件注册在调色板中,当在Delphi 6中导入OCX时,缺少该组件,这是我唯一需要处理的旧版Delphi。 Indeed the entire
TTAK_Control
component is missing from the import unit. 实际上,导入单元中缺少整个
TTAK_Control
组件。 Sometimes the import process fails. 有时导入过程会失败。
So I simply took the imported type library file from XE2 and copied it over the top of the equivalent unit in D6. 因此,我只是从XE2中获取了导入的类型库文件,并将其复制到D6中等效单元的顶部。 That's the unit named
TAK_ControlBoard_TLB
. 那就是名为
TAK_ControlBoard_TLB
的单元。 When I compiled in D6 there was a compiler error because UIntPtr
was not recognised. 当我在D6中进行编译时,由于未识别
UIntPtr
,因此发生了编译器错误。 Replace that with Cardinal
in D6. 将其替换为D6中的
Cardinal
。 At that point the compilation succeeds and the component appears on the palette. 此时,编译成功,该组件出现在面板上。
Now, when I attempt to add it to a form an OLE error is produced, but I can't really help with that since I know nothing about the component. 现在,当我尝试将其添加到表单中时,会产生OLE错误,但由于对此一无所知,我对此无能为力。 Note that this error occurs in both XE2 and D6.
请注意,此错误在XE2和D6中都发生。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.