C# Com 枚举和 VB6
您好,我创建了 C# Exe Com Server 并从 VB6 应用程序引用它。 问题在于,所有枚举在 vb 应用程序中都以“奇怪的名称”公开:EnumName_EnumItem,而从 VB6 代码中引用为 EnumName.EnumItem。
VB6应用程序代码无法修改。 想知道我看到我可以通过更改 tlb 的 idl 提取来更改这个定义,但未能准确理解它是如何完成的,以及完成这项工作的工具是什么。
有什么建议如何尽可能轻松地设置枚举?
代码:
public enum enResultCode : uint
{
enRCNone = 0x00000000,
enRCNotFound = 0x00000001,
enRCFoundOnServer = 0x00000002,
enRCFoundOnLocal = 0x00000003,
enRCDatabaseError = 0x00000004,
enRCAborted = 0xFFFFFFFF,
enRCServerError = 0xFFFFFFFE,
enRCLocalError = 0xFFFFFFFD
}
在 VB6 中显示为:
而不是:
enResultCode.EnumItemName
Hi I created C# Exe Com Server and refer it from VB6 application.
The problem is that all the enums are exposed with "strange name" in the vb app: EnumName_EnumeItem, while reffered from then VB6 code as EnumName.EnumItem.
The VB6 application code cannot be modified.
Wondering around I saw I can change this definitions by changing the idl extract fro the tlb, but failed to understand exactly how it's done, and what are the tools for the job.
Any suggestions how to set the enums easily as possible?
The code:
public enum enResultCode : uint
{
enRCNone = 0x00000000,
enRCNotFound = 0x00000001,
enRCFoundOnServer = 0x00000002,
enRCFoundOnLocal = 0x00000003,
enRCDatabaseError = 0x00000004,
enRCAborted = 0xFFFFFFFF,
enRCServerError = 0xFFFFFFFE,
enRCLocalError = 0xFFFFFFFD
}
Shown in VB6 as:
instead of:
enResultCode.EnumItemName
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你是对的,唯一的方法就是自己修改 IDL。我可以告诉您一些关于它是如何完成的...
那应该足够了。抱歉,我无法为您提供所有正确的命令行开关,但我现在不在 Windows 计算机上。
I think you're correct the only way to do this is to modify the IDL yourself. I can tell you a little about how it's done...
That should be enough. Sorry I can't give you all the correct command line switches but I'm not on a Windows machine right now.