升级到VS2010后,IsWindow(activeX.GetSafeHwnd())始终为false [英] IsWindow(activeX.GetSafeHwnd()) always false after upgrade to VS2010

查看:153
本文介绍了升级到VS2010后,IsWindow(activeX.GetSafeHwnd())始终为false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用古老的(大约在1999年)第三方ActiveX控件的MFC应用程序.

I have an MFC application that uses an ancient (circa 1999) third-party ActiveX control.

自从将项目从VS2008升级到VS2010之后,我遇到了问题...

Since upgrading the project from VS2008 to VS2010, I'm having problems...

在父对话框的OnSize处理程序中,即使GetSafeHwnd()返回非NULL值,IsWindow也会始终为control.GetSafeHwnd()返回的句柄返回false.控件的父对话框的其余部分显示正常,但似乎未响应任何输入.

In the OnSize handler of the parent dialog IsWindow always returns false for the handle returned by control.GetSafeHwnd(), even when GetSafeHwnd() returns a non-NULL value. The rest of the control's parent dialog is displayed fine, but it doesn't seem to respond to any input.

我看过这篇文章,但是在这种情况下(在第一次调用它之后,即在控件实例化之前),GetSafeHwnd()不会返回NULL.

I've seen this article, but GetSafeHwnd() isn't returning NULL in this case (after the first time that it is called, which is before the control is instantiated).

该控件的确会导致在加载时输出跟踪消息控件希望无窗口".但是,在VS2008中进行编译时也会执行此操作,因此这可能是一个麻烦.搜索此消息后,我将创建一个派生自COleControlSite的类,并拒绝控件的无窗口性,但是似乎没有很好的可用示例,而且正如我所说,目前尚不清楚这是否确实是导致这种情况的原因.问题.

The control does cause the trace message "Control wants to be windowless" to be output when it's loaded. However it also does this when compiled in VS2008, so this may be a red herring. Searching for this message points me to creating a class derived from COleControlSite, and denying the control windowless-ness, but it seems there are no good example of this available, and as I say, it's not clear that this is really the cause of the problem.

我还在 MSDN的VS2010移植页面上找到了此问题:

嵌入到其中时,使用Visual C ++ 6.0编译的ActiveX控件 使用Visual C ++ 2010开发的项目中的对话框 使您的程序在运行时断言.在这种情况下,请打开 与Visual C ++中的ActiveX控件关联的ATL或MFC项目 2010,然后重新编译.断言将位于文件occcont.cpp中, 在源代码的这一行上:ASSERT(IsWindow(pTemp-> m_hWnd))."

"An ActiveX control compiled by using Visual C++ 6.0, when embedded in a dialog box in a project developed by using Visual C++ 2010, may cause your program to assert at run time. In this situation, open the ATL or MFC project associated with the ActiveX control in Visual C++ 2010, and recompile it.. The assert will be in the file occcont.cpp, on this line in source: ASSERT(IsWindow(pTemp->m_hWnd))."

我假设存在关于VS6编译的ActiveX控件的某些问题,这些问题导致窗口句柄被IsWindow的当前Win32实现视为无效.建议的解决方案当然是无用的,因为它是第三方控件,我们无法重新编译它.

I assume that there's something about VS6-compiled ActiveX controls that causes the window handles to be treated as invalid by the current Win32 implementation of IsWindow. The suggested solution is of course unhelpful as it's a third-party control, and we can't recompile it.

有人设法解决这个问题吗?

Has anyone managed to get around this?

我已经找到了不在Windows 2000上运行的VS2010项目的解决方案,以及链接到ODBC的错误,但似乎无法在此上找到任何内容.

I've already found solutions for VS2010 projects not running on Windows 2000, and errors linking to ODBC, but don't seem to be able to find anything on this one.

谢谢

克里斯

推荐答案

我最终没有找到解决方案-将控件升级到VS2010兼容版本.

I didn't find a solution to this in the end - upgraded the controls to a VS2010-compatible version.

这篇关于升级到VS2010后,IsWindow(activeX.GetSafeHwnd())始终为false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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