You are currently browsing the category archive for the ‘COM Interop’ category.
See my earlier post for a brief description of what’s going on and note the following:
- The main class of interest is CjcWebBrowser. It starts a worker thread to take snapshots of the browser control and updates the WriteableBitmap through Dispatcher.Invoke.
- There’s some obsolete code in there (mainly in the NativeMethods folder). It could use some refactoring 🙂
- It’s tempting to revert to using the Windows Forms WebBrowser control (instead of the WPF/3.5 one). It already has a ‘DownloadProgress’ event and seemed to perform a bit better (but I could be wrong on that). Let me know if you get chance to try it…
UPDATE 3: YouCube 3.0 (based on Google Chromium) right here.
UPDATE 2: Now interactive! See here for details.
UPDATE: Added a directional light, specular highlight and trackball / mouse control… Just because I could 🙂
As you know, .NET 3.5 SP1 includes a WebBrowser control. The current implementation is just a wrapper around the MSHTML ActiveX control, which unfortunately prevents you from doing crazy things to it through WPF.
The ActiveX control itself can be queried for the IViewObject interface and have its Draw method called. The WPF WebBrowser doesn’t expose this directly, but fortunately the Windows Forms WebBrowser does (alternatively you could host MSHTML directly).
All that remains is to get the image into a WriteableBitmap… Then the fun can begin 🙂 :
My colleague Terry Aney has posted a detailed article on the “fun” he’s had creating Excel add-ins in C# (after migrating from XLAs + VBA). If you need to make several thousand calls between add-ins and Excel and want to use .NET, you should definitely run some performance comparisons first 🙂
In a related post he discusses source control strategies / workarounds for XLA files.