OLE Interapplication communication problem in C#
I've been struggling with this for days, cannot make it work. I have a c# app, and I want to open a document in Acrobat Reader, or just get the instance of a document that is already opened in an Acrobat Reader (both ways will be fine). Then I need to know when that document is closed, an event will be perfect, but any other way will be fine too. Acrobat Reader may still be running showing other documents, I just need to know when one particular document is closed.
I tried several approaches, but none seems to be working.
- By referencing AcroPDFLib I cannot do anything at all. It contains just interfaces.
- I also tried OLE IAC: getting type by ProgId works
Type acrobatType = Type.GetTypeFromProgID("AcroExch.Document.DC")
but then Activator.CreateInstance(acrobatType) only works when there is no Acrobat Reader running (obviously), but does not show Acrobat Reader, it just creates the instance in memory. There might be a method to show the window, but I don't know where to find it.
Any help or working code example will be appreciated!
