在创建窗口处理错误 [英] Error in creating windows handle

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

问题描述

我创建了一个.NET 2.0的Windows应用程序。该应用程序动态创建窗体控件。现在,当我试图运行应用程序,它抛出一个异常错误创建窗口处理。在此之后,应用程序得到挂起并没有任何反应。在第一时间,形式被正确显示。在一个特定的事件,我想重新加载相同的形式,而那个时候我收到此异常。任何人知道如何摆脱这一点。 任何形式的帮助将是巨大的全:)

I have created a .net 2.0 windows application. This application creates form controls dynamically. Now when I am trying to run the application, it is throwing an exception "Error in creating windows handle". After this, application gets hang and nothing happens. At the first time, form gets displayed properly. On a particular event I am trying to reload the same form, while that time I am getting this exception. Anybody knows how to get rid of this. Any kind of help would be great full :)

推荐答案

我想到了一个问题,就是这样的最近。

I struck an issue just like this recently.

有每10,000次把手工艺的限制 - 很容易到达,如果你动态创建一个复杂的UI

There's a limit per process of just 10,000 handles - easy to reach if you're dynamically creating a complex UI.

要检查,如果发生这种情况,则使用任务管理器 - 到进程选项卡,打开列用户对象和GDI对象。然后,重现该问题。

To check if this is happening for you, use Task Manager - go to the Processes tab, turn on the columns for "USER Objects" and "GDI Objects". Then, reproduce the problem.

在我的情况下,用户对象计数准确地击中10,000,然后轰。

In my case, the USER Object count was hitting exactly 10,000 and then "boom".

如果这是发生了什么事对你来说,你需要确保你创建一个新的表格前,老控件妥善处理。您可能需要重新设计使用较少的手柄 - 这就是我需要做的。

If this is what's happening for you, you'll need to make sure that old controls are properly disposed before you create a new form. You might need to redesign to use less handles - this is what I needed to do.

这篇关于在创建窗口处理错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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