我有一个 .exe 文件,里面有 COM 类——这些来自 C++,而不是 .netComVisible
类型
我想在我的 .net 项目中使用这些类,但我无法添加对 exe 的引用;当我尝试我得到
DIALOG BOX:
---------------------------
Microsoft Visual Studio
---------------------------
A reference to 'C:\Program Files\blah\blah.exe'
could not be added. Please make sure that the
file is accessible, and that it is a valid
assembly or COM component.
---------------------------
OK
---------------------------
tlbimp 也失败了;
TLBIMP OUTPUT:
> tlbimp blah.exe
Microsoft (R) .NET Framework Type Library
to Assembly Converter 3.5.30729.1
Copyright (C) Microsoft Corporation. All rights reserved.
TlbIml : error TI0000 : The input file
'c:\program files\blah\blah.exe' is not
a valid type library
但看起来好像有可用的 COM 类;在我的HKEY_CLASSES_ROOT
蜂巢中,我可以看到不同 COM 类的条目;
REGISTRY ENTRY:
\HKEY_CLASSES_ROOT
\CLSID
\{456B14EA-4CCC-11D4-BB91-0020AFC894E9}
@="COM.Classname"
\InprocHandler32
@="ole32.dll"
\LocalServer32
"LocalServer32"=hex(7) ...
@="C:\\PROGRA~2\\blah\blah.exe"
\ProgID
@="COM.Classname"
任何人都知道如何,即使,我可以在 .net 项目中使用这些 COM 类?