views:

250

answers:

2

I have a 3rd party ActiveX control I want to render within other presentation technologies (Direct3D and WPF). To do this, I need the ActiveX to render to a system memory bitmap instead of the screen. I know there is a way to do this, but not sure where to start. I'm not afraid of doing any native method hooking, but I'm not sure where to start. I was thinking BeginPaint(...) might be the hot ticket...

Has anyone done this or seen examples/samples floating around?

BTW, I do not want to do a WM_PRINT type solution. I'd rather this code be reactive, than proactive and forcing the hwnd to repaint.

EDIT:

Both answers were right in my case, so I gave each a +1. I wish to have a lower level solution to be more flexible, but this is good enough at the moment.

+2  A: 

You're best bet is to see if the ActiveX object supports IViewObject and call the Draw() method to get it to render into your DC.

If the object doesn't support standard OLE interfaces, you're going to have a very difficult time getting this to work. You'll have to resort to doing evil things like re-writing the DLL's import table to redirect BitBlt(), etc. I've done this sort of thing. I don't recommend it.

Your next problem will be how to correctly map input events.

jeffamaphone
+1  A: 

Does your site support the IOleInPlaceSiteWindowless interface?

Windowless support in ActiveX controls is unfortunately optional. If the 3rd party interface does support it then you can render the control using IViewObject::Draw onto whatever surface you want.

Chris Becke