How can I implement ActiveX Document on C#/.NET? (ActiveX Document can draw itself in IE)
Update: I need a solution for drawing my own document type in IE windows (like MS Word or MS Excel draw its documents in IE).
views:
555answers:
4Look at http://msdn.microsoft.com/en-us/library/system.windows.forms.htmldocument.domdocument.aspx, it's .NET wrapper for DOM Document
You need to dive into OLE for that purpose.
Things like IOleDocument, IOleInPlaceSite (see MSDN for that). Figure out which interfaces are needed for the client (as IE would be the container and will need to communicate with your interface implementations), and how the communication is going on, e.g. what gets called when.It's not rocket science, but I believe still a fair amount of work.
My first thought is that you could use a WPF Page, which can be hosted in a WPF window or in IE.
From MSDN:
Encapsulates a page of content that can be navigated to and hosted by Windows Internet Explorer, NavigationWindow, and Frame.
This is possible but it is tough.. What is bad is the lack of documentation... Microsoft has no interest in supporting this scenario. Another difficult part is debugging the boundaries between the HTML/DOM and the ActiveX control.
For what you're doing, it sounds like Silverlight would be a better choice. It only supports a subset of .Net, but it supports drawing graphics. It'll be a lot easier for you to find documentation. And it will run on non-Windows computers.
But maybe you need something Silverlight doesn't do (like audio input support). If thats the case, there's various blogs on the subject of varying quality. Here are the two that stood out as most helpful to me:
http://www.codeproject.com/KB/cs/CreateActiveXDotNet.aspx
http://blog.ianchivers.com/wordpress/?p=22
I do recommend using OleView to inspect the type libraries you produce, and make sure its what you expect. You can also do this to see how to break event properties into get/set functions, which is something I had to do to debug some scenarios.
Also be cognizant of the difference of "attaching debugger to process" with scripted or managed debugging. At some point you'll attach with one when you think you've used the other.