小编典典

Winforms问题-创建窗口句柄时出错[重复]

c#

这个问题已经在这里有了答案

“创建窗口句柄时出错” (8个答案)

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)

阅读 1301

收藏
2020-05-19

共1个答案

小编典典

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

这可能是你已经有了UI组件,您 认为 是清理,但还没有被释放。

这是一个可能对此有所帮助的链接

祝好运!

2020-05-19