Search code examples
visual-studio-2010commidl

How to build COM project in Visual Studio


Has Visual Studio integrated MIDL compiler? Can anyone explain the process for me if I want to expose more interface for other script to use? My understanding is: after adding interface in .idl, the file will be compiled to .tlb by MIDL; VS compiler understand tlb and can generate them to C files, .tli or tlh. When is the agent project automatically generated? What's tlb, tlh, tli files' role in building a COM project. I'm quite at a loss.


Solution

  • No Visualstudio has no MIDL compiler but the installed SDK has one. It compiles MIDL files that are part of a project.

    Accordingly you can add TLB files as resources into a DLL or EXE.

    Easiest start is to create a simple ATL-COM Object. Doing this with the wizards, will create all appropriate classes including the IDL file. You also get the infrastructure that is needed to register the classes, coclasses and typelibs.