ActiveX rendering through Win32 Renderer

Sep 14, 2007 at 3:25 AM
It would be awesome to have an example that shows how to render an arbitrary activeX (maybe quicktime?) using this technique, and refreshing the bitmap buffer (in the quicktime case, refreshing at say 30fps).

This would make it the ultimate approach for bringing all the legacy stuff onto WPF finally!!!
Coordinator
Sep 14, 2007 at 5:00 AM
The example shows a web-browser control, but adding an active-x should be the same. Just add reference to the active-x in your application, create a new Win32HostRenderer and assign your active-x instance to the Win32HostRenderer's ContentControl property.

The refresh rate of the control is hard-coded with a 33ms refresh interterval. We'll make it a property in the future, but you can change it in the source code.

-Jer


dcazzulino wrote:
It would be awesome to have an example that shows how to render an arbitrary activeX (maybe quicktime?) using this technique, and refreshing the bitmap buffer (in the quicktime case, refreshing at say 30fps).

This would make it the ultimate approach for bringing all the legacy stuff onto WPF finally!!!

Oct 6, 2011 at 9:28 AM
jmorrill wrote:
The example shows a web-browser control, but adding an active-x should be the same. Just add reference to the active-x in your application, create a new Win32HostRenderer and assign your active-x instance to the Win32HostRenderer's ContentControl property.

Hi!

I have XAML code:

<i:Win32HostRenderer x:Name="Win32HostRendererPresentation" Debug="True">
<i:Win32HostRenderer.ContentControl>
<forms:WebBrowser Width="400" Height="400"/>
</:Win32HostRenderer.ContentControl>
</i:Win32HostRenderer>

 

But I have exception:

System.Reflection.TargetParameterCountException
Parameter count mismatch.


at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at WPFInterop.BitmapBuffer.SetBufferInfo()
at WPFInterop.BitmapBuffer..ctor(BitmapSource Image)
at WPFInterop.Interop.Win32HostRenderer.InitializeBitmap()
at WPFInterop.Interop.Win32HostRenderer.RenderWinformControl()
at WPFInterop.Interop.Win32HostRenderer._rendererTimer_Tick(Object sender, EventArgs e)
at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

 

If I do not set ContentControl property all is ok!