Winforms 问题 - 创建窗口句柄时出错 [英] Winforms issue - Error creating window handle

查看:55
本文介绍了Winforms 问题 - 创建窗口句柄时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在 Winform 应用程序中看到此错误.任何人都可以帮助解释为什么您会看到此错误,更重要的是如何修复它或避免它发生.

<前>System.ComponentModel.Win32Exception:创建窗口句柄时出错.在 System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)在 System.Windows.Forms.Control.CreateHandle()在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)在 System.Windows.Forms.Control.CreateControl()在 System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)在 System.Windows.Forms.ButtonBase.OnVisibleChanged(EventArgs e)

解决方案

您是否运行过进程资源管理器或 Windows 任务管理器来查看 GDI 对象、句柄、线程和 USER 对象?如果没有,请选择要查看的那些列(任务管理器选择查看"->选择列"...然后运行您的应用程序并查看该应用程序的那些列,看看其中一个列是否变得非常大.

可能是您的 UI 组件认为已清理但尚未处理.

这里有一个链接,可能会有帮助.

祝你好运!

We are seeing this error in a Winform application. Can anyone help on why you would see this error, and more importantly how to fix it or avoid it from happening.

System.ComponentModel.Win32Exception: Error creating window handle.
   at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
   at System.Windows.Forms.Control.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.ButtonBase.OnVisibleChanged(EventArgs e)

解决方案

Have you run Process Explorer or the Windows Task Manager to look at the GDI Objects, Handles, Threads and USER objects? If not, select those columns to be viewed (Task Manager choose View->Select Columns... Then run your app and take a look at those columns for that app and see if one of those is growing really large.

It might be that you've got UI components that you think are cleaned up but haven't been Disposed.

Here's a link about this that might be helpful.

Good Luck!

这篇关于Winforms 问题 - 创建窗口句柄时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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