在 ATL ActiveX 控件中嵌入 WTL 应用程序

发布于 2024-08-27 19:05:27 字数 669 浏览 3 评论 0原文

有没有办法以某种方式在 ATL ActiveX(即扩展)中嵌入 WTL destop 应用程序?

我想要实现的是使用 Office 文件查看器创建 ActiveX 控件。 作为基础,我有一个桌面 WTL 应用程序(不久前编写),它使用 OOo v3 API 来显示文档。

  • 我创建了一个 ActiveX 项目,链接了必要的库并包含。
  • 我可以调用WTL和OO Api方法。
  • 添加了一些属性和方法来满足主机应用程序的要求。
  • 我的 ActiveX 在 ie 和主机应用程序中正确显示,

我的运气(和知识?)到此结束。

我的控件具有 m_hwnd 属性,但它始终设置为 0; 我用谷歌搜索了一下,发现我可以获取父 hwnd,

this->m_spInPlaceSite->GetWindow()

但它也不起作用。每次我想创建一个窗口运行时都以 IsWindow() 方法(从 ATL lib 中调用)结束,父级==null

要创建并显示 OOo::DocWindow 我需要父窗口的 HWND。

那么问题来了:

我能以某种方式在 ActiveX ie 扩展中嵌入一个基于 WTL Window 的应用程序吗?
是否可以不重写整个 OOo Api 包装器?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青芜 2024-09-03 19:05:27

是的,你可以。

使用 VS 向导的步骤:

  1. 创建 ATL 项目
  2. 添加 ATL 控件,基于某些控件(例如按钮)。在这种情况下,您将拥有带有一些处理程序的消息映射。

然后将 CContainedWindow 成员替换为您自己的窗口即可。

ATL 示例页面,我没有不检查,但希望有帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文