解决Win7OCX内部无法发送自定义消息的debug
来源:互联网 发布:产品外观设计软件 编辑:程序博客网 时间:2024/06/16 12:10
PRB: ActiveX 控件窗口才创建在 Internet Explorer 中可见
注意:这篇文章是由无人工介入的微软自动的机器翻译软件翻译完成。微软很高兴能同时提供给您由人工翻译的和由机器翻译的文章, 以使您能使用您的语言访问所有的知识库文章。然而由机器翻译的文章并不总是完美的。它可能存在词汇,语法或文法的问题,就像是一个外国人在说中文时总是可能犯这样的错误。虽然我们经常升级机器翻译软件以提高翻译质量,但是我们不保证机器翻译的正确度,也不对由于内容的误译或者客户对它的错误使用所引起的任何直接的, 或间接的可能的问题负责。
点击这里察看该文章的英文版: 195188
本文已归档。它按“原样”提供,并且不再更新。
症状
ASSERT(::IsWindow(m_hWnd));
ATLASSERT(::IsWindow(m_hWnd));
原因
解决方案
MFC
MFC 提供调用 COleControl::CreateControlWindow() 来创建控件的窗口的函数。MFC 的 IOleObject::SetClientSite() 实现调用 COleControl::OnSetClientSite()。向您 COleControl 派生的类中添加以下项 ︰ // CMyControl is derived from COleControl. void CMyControl::OnSetClientSite() { if (m_pClientSite) // It doesn't matter who the parent window is or what the size of // the window is because the control's window will be reparented // and resized correctly later when it's in-place activated. VERIFY (CreateControlWindow (::GetDesktopWindow(), CRect(0,0,0,0), CRect(0,0,0,0))); COleControl::OnSetClientSite(); }
ATL
ATL 还提供了一个名为 CComControl::CreateControlWindow() 的函数。 // CMyControl is derived from CComControl STDMETHOD(SetClientSite)(IOleClientSite *pClientSite) { if (pClientSite) { RECT rc = {0,0,0,0}; // Don't have access to the container's window so just use the // desktop. Window will be resized correctly during in-place // activation. HWND hWnd = CreateControlWindow(::GetDesktopWindow(), rc); _ASSERT (hWnd); } return IOleObjectImpl<CMyControl>::SetClientSite (pClientSite); } HRESULT InPlaceActivate(LONG iVerb, const RECT* prcPosRect) { // Get the container's window. _ASSERT (m_spClientSite); LPOLEINPLACESITE pInPlaceSite = NULL; HRESULT hr = m_spClientSite->QueryInterface(IID_IOleInPlaceSite, (void **)&pInPlaceSite); _ASSERT (SUCCEEDED (hr) && pInPlaceSite); HWND hParent = NULL; hr = pInPlaceSite->GetWindow (&hParent); _ASSERT (SUCCEEDED (hr) && hParent); pInPlaceSite->Release (); // Set container window as our parent window SetParent (hParent); return CComControlBase::InPlaceActivate(iVerb, prcPosRect); }
状态
更多信息
无窗口控件、 窗体控件在 Internet Explorer 中支持的 4.x 和 Visual C++ 4.2 或更高版本,采用第一种方法。
但是,它可能是极难或不可能重新设计现有的控件,在这些情况中工作。某些控制措施可能需要太多额外的代码来有效地不在窗口。对于此类控件,可以在解决方法部分中使用此替代方法。
如果 ActiveX 控件定位上的可见部分的 HTML 页,但控件的窗口仍未创建了,则从本文中讨论的一个不同的问题。该控件可能无窗口控件的默认值。
引用
http://msdn.microsoft.com/ie/
http://support.microsoft.com/iep
http://support.microsoft.com/iep
Warning: This article has been translated automatically
0 0
- 解决Win7OCX内部无法发送自定义消息的debug
- 使用AppDelegate单例,解决子视图无法给父视图发送消息的问题
- 工作线程调用sendmessage()向主对话框发送自定义消息遇到的问题以及解决
- 终于解决JBuilder无法Debug的问题
- 自定义消息的发送与接收处理
- 自定义消息的发送与响应:
- 自定义消息及发送
- 总结:发送自定义消息
- 总结:发送自定义消息
- 总结:发送自定义消息
- 总结:发送自定义消息
- 自定义消息发送字符串
- MFC - 发送自定义消息
- TD无法发送邮件问题的解决
- 解决Pushlet无法发送中文的问题
- 融云利用自定义消息的方式发送自定义表情
- Debug程序无法运行解决
- 解决android Device无法debug
- MiniUI总结
- Usb协议
- Hadoop2.7.2之集群搭建(高可用)
- 一个经典例子让你彻彻底底理解java回调机制
- android中的回调
- 解决Win7OCX内部无法发送自定义消息的debug
- 笔记1
- java入门教程-1.4Java的不同版本:J2SE、J2EE、J2ME的区别
- 上传app错误
- Cornerstone永久试用
- 关于android listview分割线隐藏的问题
- TCP的流量控制
- 推荐一个公司内部接口文档管理方案
- 韩顺平Spring框架学习,学习笔记(二)