Question

Is there a way to somehow Embed a WTL destop application in ATL ActiveX (ie extension)?

What I'm trying to achieve is to create an ActiveX control with office files Viewer. As a base I have a desktop WTL application (written some time ago) which uses OOo v3 API to display documents.

  • I have created an ActiveX project, linked necessary libs and includes.
  • I can call WTL and OO Api methods.
  • Some properties and methods have been added to meet requirements of the host application.
  • My ActiveX is properly shown in ie and host application

And here my luck (and knowledge?) ended.

My control has m_hwnd property but it is always set to 0; I've Googled a bit and found that i Can get parent hwnd with

this->m_spInPlaceSite->GetWindow()

but it's not working either. Every time I want to create a window runtime ends in IsWindow() method (called from within ATL lib) with parent==null

To create and show OOo::DocWindow I need HWND of the parent Window.

And here goes the question:

Can i somehow embed a WTL Window-based application in ActiveX ie extension?
Is it possible without re-writing whole OOo Api wrapper?

Was it helpful?

Solution

Yes, you can.

Steps with VS wizard:

  1. Create ATL project
  2. Add ATL Control, based on some control (button, for example). In this case you'll have message map with some handlers.

Then replace CContainedWindow member to your own window and that's all.

ATL Samples page, I didn't check it, but hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top