How to import COM into Ironpython?
Question: In Cpython, I can use win32com.

But, in ironpython, I didn't know how to import it.

Because, in .net, one always use Visual Studio to interop the COM and to use
it.


Answer: You should be able to create an IDispatch object using:

    
    
    from System import Type, Activator
    Activator.CreateInstance(Type.GetTypeFromProgID(com_type_name))
    

This is equivalent to win32com.client.Dispatch(com_type_name).

If there's a type lib you should be able to do:

    
    
    import clr
    import System
    typelib = clr.LoadTypeLibrary(System.Guid("00020905-0000-0000-C000-000000000046"))
    word = typelib.Word.Application()
    

I don't know what that's equivalent to. I'm not much of an expert on this but
I took those from [IronPython's
cominterop_util](http://ironpython.codeplex.com/SourceControl/changeset/view/75792#1090265)
which is used in the tests. There's more stuff in the
IronPython\Tests\interop\com directory which might be useful.

