Registration Free COM errors with EXE

混江龙づ霸主 提交于 2019-12-11 05:37:08

问题


I'm trying to use COM functions exposed by an EXE. I've created a C# project using Visual Studio 2010 (on a windows7/x64 machine) and added the reference to that EXE, then set the Isolated flag to true. When I build the solution, I get errors for each of the classes that it exposes.

Problem isolating COM reference 'FNCClient11Lib': Registry key 'HKEY_CURRENT_USER\SOFTWARE\CLASSES\CLSID{e49b30c9-6d7e-48f5-91da-f2f0414c6a13}\InProcServer32' is missing value '(Default)'.

These entries don't exist in the registry in that location but DO exist here (below)

HKEY_CURRENT_USER\Software\Classes\Wow6432Node\CLSID{E49B30C9-6D7E-48F5-91DA-F2F0414C6A13}

  • Is there any way I can point this to the right location in the registry when building?
  • Can I reference an EXE? All the examples I've seen so far reference DLLs only.

回答1:


This problem occurs when the type library contains classes that are marked as 'uncreatable' in the COM interface. You can check this by using the OLE/COM Viewer (as Admin), navigating to the type library that causes the problem, opening it and look up the CoClass definitions. If the one using the reported uuid is declared 'uncreatable', you got it. Also, in the VS object browser, these clases don't expose a constructor in the interface.

My solution was to rebuild the COM component with a public constructor for these classes but of course this is only possible if you have the sources.

Finally, there may be other reasons for this symptom though ...



来源:https://stackoverflow.com/questions/8914138/registration-free-com-errors-with-exe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!