how can I tell how many window handles are free

  • Thread starter Thread starter ngr
  • Start date Start date
N

ngr

I have come across a problem because I have too many controls on a form.

It says that it cannot create a handle.

Now I know that there is a limit of how many windows handles which can be
used in any one process, but would like to know in VB.NET 2005 how I can
tell at any one point in code how many window handles are free.

I would like something on a timer control which reported to a textbox how
many handles are remaining.
Alternatively something I can run from a button to report to a messagebox
how many handles remain unused.

Thanks in advance for any feedback

Terry
 
I have come across a problem because I have too many controls on a form.

It says that it cannot create a handle.

Now I know that there is a limit of how many windows handles which can be
used in any one process, but would like to know in VB.NET 2005 how I can
tell at any one point in code how many window handles are free.

I would like something on a timer control which reported to a textbox how
many handles are remaining.
Alternatively something I can run from a button to report to a messagebox
how many handles remain unused.

Thanks in advance for any feedback

Terry

I think you can get that information via wmi. You'll need to check.
But, the issue here is why do you have so many controls? XP I believe
allows something like 10000 hWnds per process. Are you showing forms
with tons of controls and then not disposing of them? If that isn't
the case - then you might want to rethink your interface some...
Maybe use a grid type interface, etc. This is one problem with
windows forms - there is no concept of a windowless control, as we had
in vb6.
 
Back
Top