Delphi 7.0 中的 ActiveX 安装
我在我的项目中使用 ActiveX 组件。我可以将此组件添加到 Visual Studio 2010、2008、Delphi XE2、Visual Basic 6.0,但无法将其导入 Delphi 版本 5、6 或 7。
这是我的 ftp 服务器中的 activex 文件: Active X 文件
I am using an ActiveX component in my projects. 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.
This is the activex file in my ftp server: Active X File
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我有足够的勇气下载并注册了这个 OCX,并尝试复制你所做的事情。是的,我发现了与您报告的相同的行为。
于是,我查看了XE2中导入的类型库单元。请记住,在 XE2 中,组件出现在调色板上。单元底部是这段代码:
这段代码在调色板中注册组件,当 OCX 导入到 Delphi 6(我唯一需要使用的旧 Delphi)中时,它会丢失。事实上,导入单元中缺少整个
TTAK_Control
组件。有时导入过程会失败。因此,我只是从 XE2 中获取导入的类型库文件,并将其复制到 D6 中的等效单元的顶部。这是名为
TAK_ControlBoard_TLB
的单元。当我在 D6 中编译时,出现编译器错误,因为UIntPtr
未被识别。将其替换为 D6 中的Cardinal
。此时编译成功并且组件出现在调色板上。现在,当我尝试将其添加到表单时,会产生 OLE 错误,但我无法真正提供帮助,因为我对该组件一无所知。请注意,XE2 和 D6 中都会出现此错误。
OK, I was brave enough to download and register this OCX and try to replicate what you did. And yes I found the same behaviour as your reported.
So, I looked at the imported type library unit in XE2. Remember that in XE2 a component appears on the palette. At the bottom of the unit is this code:
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. Indeed the entire
TTAK_Control
component is missing from the import unit. 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. That's the unit named
TAK_ControlBoard_TLB
. When I compiled in D6 there was a compiler error becauseUIntPtr
was not recognised. Replace that withCardinal
in D6. 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. Note that this error occurs in both XE2 and D6.