This question already has answers here:
“Error Creating Window Handle”

(9个答案)


7年前关闭。




我们在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)

最佳答案

您是否已运行Process Explorer或Windows Task Manager来查看GDI对象,句柄,线程和USER对象?如果没有,请选择要查看的那些列(任务管理器选择“ View ”->“选择列...”,然后运行您的应用程序,并查看该应用程序的那些列,看看其中是否有一个真的很大。

您可能已经清理了一些UI组件,但尚未对其进行处置。

Here's a link可能对此有所帮助。

祝你好运!

07-25 22:54
查看更多