在 TLBIMP-ed dll 之后手动生成 ActiveX 包装器? [英] Manually generate ActiveX wrapper after TLBIMP-ed dlls?

查看:11
本文介绍了在 TLBIMP-ed dll 之后手动生成 ActiveX 包装器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个 ActiveX 组件需要从 C# 项目中访问.

I have several ActiveX components that needed to be accessed from a C# project.

我可以通过 Visual Studio 的添加引用对话框导入它们,该对话框也会自动生成包装类.(即 ABCLibAxABCLib)

I can import them via Visual Studio's add reference dialog, which will also automatically generate wrappers class. (i.e. ABCLib and AxABCLib)

我知道我可以通过在每个单独的 OCX 文件上运行 TLBIMP/primary 来手动生成主互操作程序集,但我找不到生成 ActiveX 包装器的方法,除非我通过 Visual Studio 执行此操作用户界面.

I know that I can generate the primary interop assembly manually by running TLBIMP /primary on each individual OCX file but I could not find a way to generate the ActiveX wrapper unless I do it via Visual Studio user interface.

是否有在 .NET SDK 中生成 ActiveX 包装器的命令行版本?

Is there a command-line version that generate the ActiveX wrapper in the .NET SDK?

我想从我手动从 TLBIMP 获得的 PIA 生成 AxABCLib 版本.(即设置命名空间、输出 dll 文件名等)有可能吗?

I want to generate the AxABCLib version from the PIA I got from TLBIMP manually. (i.e. setting namespaces, output dll filenames etc.) Is it possible?

推荐答案

哦……看了看TLBIMP所在的文件夹找到了.

Oh... found it after looking at the folder where TLBIMP belongs.

它叫做AxImp.

C:Program FilesMicrosoft SDKsWindowsv6.0AinAxImp.exe

所以基本上,要在您自己的自定义命名空间中生成 PIA DLL:

So basically, to generate a PIA DLL in your own customized namespace:

  1. 注册您的 OCX

  1. Register your OCX

regsvr32 abc.ocx

通过运行为您的 ocx 生成一个强名称密钥对

Generate a strong name key pair for you ocx by running

sn -k

运行 TLBIMP 并指定所需的命名空间

Run TLBIMP and specify the desired namespace

tlbimp abc.ocx/primary/keyfile:abc.snk/out:abc.dll/namespace:MyNamespace

在 ocx 上运行 AXIMP 并使用 rcw 开关来使用您自己手动生成的 PIA DLL.

Run AXIMP on the ocx and use the rcw switch to use your own manully generated PIA DLL.

aximp abc.ocx/source/rcw:abc.dll

应该可以的.

然而,导入古代 TLB 存在一些问题.我还不确定如何解决这个问题.

There are however some problems with ancient TLBs being imported. I am not sure how to fix that yet.

这篇关于在 TLBIMP-ed dll 之后手动生成 ActiveX 包装器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆