如何将activeX嵌入Atl Composite Control? [英] How to embed an activeX to Atl Composite Control?

查看:105
本文介绍了如何将activeX嵌入Atl Composite Control?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将activeX嵌入Atl Composite Control?

问题是如何将一个ActiveX放到另一个?



我尝试过在谷歌找到答案但没有找到



让我们看一个例子



我正在制作Atl Composite Control

我在Visual Studio 2010中的步骤:

1.创建Visual C ++ ATL项目

2.创建一个Atl复合控制例如AnimWrapper使用向导

3.在资源IDD_AnimWrapper中插入任意ActiveX控件(例如Microsoft Animation Control 6.0)



我需要在我的ActiveX方法中调用插入动画控件的方法



我将非常感谢你的帮助

How to embed an activeX to Atl Composite Control?
The question is How to put one ActiveX to another?

I tried to find an answer in google but nothing was found

Let''s look at an example

I''m making Atl Composite Control
My steps in visual studio 2010:
1. create Visual C++ ATL Project
2. create an Atl Composite Control e.g. "AnimWrapper" using wizard
3. insert an arbitrary ActiveX control (e.g. "Microsoft Animation Control 6.0") in resource IDD_AnimWrapper

I need to call methods of inserted Animation control in methods of my ActiveX

I will be very thankful for your help

推荐答案

很简单。

It is easy.
//ATL ActiveX wnd for the nested control, best place is as a class member
CAxWindow wndAnimationWnd; 


//best in OnCreate:
wndAnimationWnd.Create(hWndOfYourControl, //hwnd of outer control
     &rect_ForEmbededAnimation,    //client coordinates inside the outer control
     string_CLSID_OfYourAnimationControl, //must be string
     WS_CHILD | WS_VISIBLE);





例如,Internet Explorer ActiveX控件





Just as example, the Internet Explorer ActiveX control

CAxWindow wndBrowser; //somewhere a member inside your class


//best in OnCreate:
LPOLESTR sClsid = L"";
StringFromCLSID( CLSID_WebBrowser, &sClsid );
wndBrowser.Create(this->m_hWnd, &rcClient, sClsid, WS_CHILD | WS_VISIBLE);





之后你可能需要操纵控件:



After that you probably need to manipulate the control:

CComPtr<IUnknown> pUnk;
hr = AtlAxGetControl( wndBrowser, &pUnk ); //get the IUnknown of your nested control


CComQIPtr<IWebBrowser2> spBrowser2; //IDispatch or any other needed interface
hr = pUnk->QueryInterface(&spBrowser2);
CComVariant navigate_to(L"http://google.com");
hr = spBrowser2->Navigate2(&navigate_to, 0, 0, 0, 0);


谢谢你的帮助

你的解决方案真的帮我解决了问题!

我需要行
Thank you for you help
Your solution really helped me work out the problem!
I needed the row
hr = AtlAxGetControl( wndBrowser, &pUnk );





因此,在复合控制拉伸后,内部ActiveX拉伸仍然存在。



So It''s remained to make inner ActiveX stretch following composite control stretching.


这篇关于如何将activeX嵌入Atl Composite Control?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆