Wednesday, November 15, 2006

COM in the mirror

I spent the better part of a day bashing my head against the brick wall that is .NET Reflection on COM objects, specifically the DSOFile.dll which Microsoft supply for manipulating the OLE properties of files. I worked it out though, and since there was no direct help that I could find on Google, I figured I would post it here as it will be fairly sure to come up.

So, onwards with an explanation of Reflection on/with/and DSOFile.dll:

It is late at night and I can't remember the specifics off the top of my head ( I will put them up when I can ), but the gist of it is that normally when using the DSOFile in an early bound manner, you instantiate an OleDocumentPropertiesClass from the identifier that Visual Studio creates for you when you add DSOFile.dll as a reference; however, if you want to do much reflection on the DSOFile COM object you need to load the assembly yourself using System.Reflection.Assembly.LoadFrom( ) and then reflect off of that instead.

Again, sorry for the very vague information, I'll put more up tomorrow.

No comments: