none
How can I access a C++ COM exe server in C# RRS feed

  • Question

  • I ran into a situation to call a C++ COM server in C#. This COM server is an exe server (or out of process COM server). I knew we can refer a C++ dll COM server (in process COM server) by using the Type Library Importer. Can be an exe COM server be referred in the same way or should it be done in other ways? My most C# books deal only with C++ dll COM server.

    Thanks!


    • Edited by YangmeiGe Tuesday, December 13, 2011 4:16 AM
    • Moved by Leo Liu - MSFT Wednesday, December 14, 2011 6:06 AM Moved for better support. (From:Visual C# General)
    Tuesday, December 13, 2011 4:15 AM

Answers

  • You can read the MSDN document:

    COM Interop Part 1: C# Client Tutorial

     

    COM Interop provides access to existing COM components without requiring that the original component be modified. When you want to incorporate COM code into a managed application, import the relevant COM types by using a COM Interop utility (TlbImp.exe) for that purpose. Once imported, the COM types are ready to use.

     

    COM Interop works with COM object-- COM assembly, no matter it is a dll or an exe.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by YangmeiGe Monday, December 19, 2011 4:05 AM
    Wednesday, December 14, 2011 8:49 AM

All replies

  • Hello YangmeiGe,

     

    >> Can be an exe COM server be referred in the same way or should it be done in other ways?

    1. A COM EXE-based server is referred to in the same way as a COM DLL.

    2. You can reference the EXE server's type library file or reference the EXE itself (the type library is embedded as a resource of the EXE).

    - Bio.

     


    Please visit my blog : http://limbioliong.wordpress.com/
    Tuesday, December 13, 2011 4:57 AM
  • You can read the MSDN document:

    COM Interop Part 1: C# Client Tutorial

     

    COM Interop provides access to existing COM components without requiring that the original component be modified. When you want to incorporate COM code into a managed application, import the relevant COM types by using a COM Interop utility (TlbImp.exe) for that purpose. Once imported, the COM types are ready to use.

     

    COM Interop works with COM object-- COM assembly, no matter it is a dll or an exe.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by YangmeiGe Monday, December 19, 2011 4:05 AM
    Wednesday, December 14, 2011 8:49 AM
  • Thanks! I have verified TlbImp.exe works in my case.
    Monday, December 19, 2011 4:06 AM