我们在Winform应用程序中看到这个错误。这该如何解决呢?具体如下:
System.ComponentModel.Win32Exception:创建窗口句柄时出错。
在System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
在System.Windows.Forms.Control.CreateHandle()
在System.Windows.Forms.Control.CreateControl(布尔fIgnoreVisible)
在System.Windows.Forms.Control.CreateControl()
在System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
在System.Windows.Forms.ButtonBase.OnVisibleChanged(EventArgs e)
发布于 2018-03-12 16:28:37
你是否运行Process Explorer或Windows任务管理器来查看GDI对象,句柄,线程和USER对象?如果没有,请选择要查看的列(任务管理器选择查看 - >选择列...然后运行您的应用程序,并查看该应用程序的那些列,看看其中的一个是否真的变大。
这可能是因为您已经获得了您认为已被清理但未被处置的UI组件。
发布于 2018-03-12 17:01:22
你的应用程序的窗口句柄限制为10,000个句柄。你得到的错误是因为你的程序创建了太多的句柄。你需要找到内存泄漏。正如其他用户建议的那样,使用Memory Profiler。
https://stackoverflow.com/questions/-100007593
复制相似问题