I need to pass a Scripting.Dictionary between my C# app and another app. I would like to be able to create instances of and modify the dictionary in my C# app.
I know little about Scripting.Dictionary and ActiveX in general. Various forums suggest that I should use functions like System.Type.GetTypeFromProgID() and System.Activator.CreateInstance() to create an instance. Unfortunately this means that it’s an opaque object to the rest of my code.
Is this really how it’s supposed to be done or is there a better way? Ideally I’d like to import a compile-time type and just use it like any other type. Is this possible?
This article suggests I obtain a ‘metadata assembly’ from the vendor – does anyone know if such an assembly exists for Scripting.Dictionary?
I’ve just tried the easiest approach, and it seems to work:
Add a COM reference to the scrrun.dll in Visual Studio (it should show up in the COM tab of the Add References dialog), and Visual Studio will automatically create the interop files for you. You can then write code like this:
If you have any trouble with that, I can post some more examples, or perhaps a clarification.