C# 无法获取窗口句柄,不支持无窗口 ActiveX 控件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/989663/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 05:01:55  来源:igfitidea点击:

Unable to get window handle, Windowless ActiveX controls are not supported?

c#.net-3.5windows-7interopactivex

提问by jasonh

I upgraded my development machine to Windows 7 and my project to .NET 3.5. When I try to run the project, I now get this error:

我将我的开发机器升级到 Windows 7,将我的项目升级到 .NET 3.5。当我尝试运行该项目时,我现在收到此错误:

Unable to get the window handle for the 'AxVt' control. Windowless ActiveX controls are not supported.

The project is using the Dart Emulation for ActiveX Vt control, which emulates a terminal control. I double-checked and the program launches fine under Windows XP SP2 with .NET 3.5, so it's not the Framework causing the issue. Setting compatibility mode to Windows XP SP2 doesn't help either. This exception occurs when the designer code calls EndInit on the control.

该项目使用 Dart Emulation for ActiveX Vt 控件,它模拟终端控件。我仔细检查过,程序在带有 .NET 3.5 的 Windows XP SP2 下正常启动,所以不是框架导致了问题。将兼容模式设置为 Windows XP SP2 也无济于事。当设计器代码在控件上调用 EndInit 时会发生此异常。

Is there any way to work around this or does it just mean I have to remove Windows 7 from my machine and go back to Windows XP?

有什么办法可以解决这个问题,还是只是意味着我必须从我的机器上删除 Windows 7 并返回到 Windows XP?

采纳答案by No hay Problema

Try switching DEP off just to see if is that issue, I had it before, check here: http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspxto find out how.

尝试关闭 DEP 以查看是否是那个问题,我以前遇到过,请在此处查看:http: //blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler。 aspx以了解如何操作。

Cheers

干杯

回答by John Fisher

It is quite likely that the third party control you're using doesn't (yet) work with Windows 7, since it's still in beta. Have you checked with the maker?

您使用的第三方控件很可能(还)不适用于 Windows 7,因为它仍处于测试阶段。你和厂家确认了吗?

Most software implemented on top of both COM and the Windows APIs is likely to end up with difficulties when switching between versions of Windows, particularly versions that didn't exist when the software was written. Hopefully, with a bit of time, the company making the product will have a hotfix or update for you.

大多数在 COM 和 Windows API 之上实现的软件在 Windows 版本之间切换时可能会遇到困难,尤其是在编写软件时不存在的版本。希望一段时间后,生产该产品的公司将为您提供修补程序或更新。