【发布时间】:2017-01-10 13:21:30
【问题描述】:
我是C# 的新手,需要在我的应用程序中使用COM DLL。
我已经针对原来的DLL 执行了tlbimp,用regsvr32 注册了我的新DLL,用ildasm 查看了DLL 的内容,然后使用@ 重新创建并签署了DLL 987654330@(使用与我的 C# 项目相同的密钥)。
然后我将新签名的DLL 添加到我的GAC。
我在我的应用程序中向DLL 添加了一个reference,并且能够在DLL 结构中输出每个method 的Type。
我希望这个
DLL有一个array(s)的值,但无法执行get方法并且在结构转储文件中看不到任何数组。我期望的两个数组类型为
INT和STRING。这个DLL应该能够填充combobox
下面是使用ildasm的DLL转储
有人可以告诉我这个
DLL中是否确实有一组值,或者我是否应该停止旋转我的轮子?
___[MOD]
| M A N I F E S T
|___[NSP] CSCICom_Usable
| |___[INT] CSCICom_Usable.Class1
| | | .class interface public abstract auto ansi import
| | | implements CSCICom_Usable._Class1
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 32 34 42 33 31 37 34 37 2D 41 46 42 36 // ..$24B31747-AFB6 ...
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.CoClassAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 1A 43 53 43 49 43 6F 6D 5F 55 73 61 62 6C // ...CSCICom_Usabl ...
| |
| |___[CLS] CSCICom_Usable.Class1Class
| | | .class public auto ansi import
| | | implements CSCICom_Usable._Class1
| | | implements CSCICom_Usable.Class1
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.TypeLibTypeAttribute::.ctor(valuetype [mscorlib]System.Runtime.InteropServices.TypeLibTypeFlags) = ( 01 00 02 00 00 00 00 00 ) ...
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 37 32 43 45 36 35 44 45 2D 46 30 42 38 // ..$72CE65DE-F0B8 ...
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.ClassInterfaceAttribute::.ctor(valuetype [mscorlib]System.Runtime.InteropServices.ClassInterfaceType) = ( 01 00 00 00 00 00 00 00 ) ...
| | |___[MET] .ctor : void()
| | |___[MET] GetIncidentCodes : class [VBA]VBA.Collection()
| |
| |___[INT] CSCICom_Usable.Class2
| | | .class interface public abstract auto ansi import
| | | implements CSCICom_Usable._Class2
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 41 38 38 36 33 32 42 42 2D 41 46 46 31 // ..$A88632BB-AFF1 ...
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.CoClassAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 1A 43 53 43 49 43 6F 6D 5F 55 73 61 62 6C // ...CSCICom_Usabl ...
| |
| |___[CLS] CSCICom_Usable.Class2Class
| | | .class public auto ansi import
| | | implements CSCICom_Usable._Class2
| | | implements CSCICom_Usable.Class2
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.TypeLibTypeAttribute::.ctor(valuetype [mscorlib]System.Runtime.InteropServices.TypeLibTypeFlags) = ( 01 00 02 00 00 00 00 00 ) ...
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 41 30 43 39 46 42 45 45 2D 42 36 45 38 // ..$A0C9FBEE-B6E8 ...
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.ClassInterfaceAttribute::.ctor(valuetype [mscorlib]System.Runtime.InteropServices.ClassInterfaceType) = ( 01 00 00 00 00 00 00 00 ) ...
| | |___[MET] .ctor : void()
| | |___[MET] get_Code : int16()
| | |___[MET] get_Name : string()
| | |___[MET] set_Code : void(int16)
| | |___[MET] set_Name : void(string)
| | |___[PTY] Code : int16()
| | |___[PTY] Name : string()
| |
| |___[INT] CSCICom_Usable._Class1
| | | .class interface public abstract auto ansi import
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.TypeLibTypeAttribute::.ctor(valuetype [mscorlib]System.Runtime.InteropServices.TypeLibTypeFlags) = ( 01 00 D0 10 00 00 00 00 ) ...
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 32 34 42 33 31 37 34 37 2D 41 46 42 36 // ..$24B31747-AFB6 ...
| | |___[MET] GetIncidentCodes : class [VBA]VBA.Collection()
| |
| |___[INT] CSCICom_Usable._Class2
| | | .class interface public abstract auto ansi import
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.TypeLibTypeAttribute::.ctor(valuetype [mscorlib]System.Runtime.InteropServices.TypeLibTypeFlags) = ( 01 00 D0 10 00 00 00 00 ) ...
| | | .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 41 38 38 36 33 32 42 42 2D 41 46 46 31 // ..$A88632BB-AFF1 ...
| | |___[MET] get_Code : int16()
| | |___[MET] get_Name : string()
| | |___[MET] set_Code : void(int16)
| | |___[MET] set_Name : void(string)
| | |___[PTY] Code : int16()
| | |___[PTY] Name : string()
| |
|
【问题讨论】:
-
您在寻找什么样的值数组?值应该代表什么?
-
我希望这个应用程序能够给我两个数组的值,一个是
STRING另一个是INT另外我希望这两个值相互关联,它们是警察代码和代码名称 -
如果您觉得这值得一票否决,请至少解释一下,以便我改进
-
我怀疑 StackOverflow 上的某个人以相当随意的方式对标记为
com、atl、activex等的问题投了反对票。一个常见的模式似乎是低代表用户的问题,即新用户。
标签: c# .net dll com com-interop