What programming methods affect the number of window handles?

I get a runtime error "Error creating window handle." From my research, I know that this error usually indicates that the application has exceeded the Windows 10,000 descriptor limit, and I must resolve the error by making sure that the descriptors are not created unnecessarily and disposed of properly.

However, I can not find the documentation of what causes the creation of the window handle. Is a window handle created every time I create a form? Every time I create a control? Every time I create a class? Or what?

Is it possible to say that for applications with a lightweight UI there is no need to particularly worry about the number of handles used, but for applications with many graphic elements, programmers should take measures to limit the number of window handles? Is this what "windowless controls" and "light controls" are? Are there any other important concepts that I should know about?

So far, I have not thought that my application is particularly intensive. However, it displays a chart grid, where each chart is a user control consisting of several component controls. For large analyzes, the total number of controls can reach thousands. Assuming I want to save this grid, are there specific methods that I can apply to save the countdown? For example, is there a way to โ€œrenderโ€ a control so that it is still visible but no longer needs a window handle?

-TC

+3
source share
2 answers

However, I can not find the documentation of what causes the creation of the window handle.

This is probably because .net is an abstraction.

"" Win32 HWND . , .. HWND.

, . ( C Windows API) , , . , , , . (), , GDI.

, , , HWND, .

, , C/Win32 CreateWindow(). .

, .net APP. , , CreateWindow, HWND .

Windows, .

, ? Window. Windows - . - , , .

, . , , .

+4

, , . , , , , . , , .

. , , , . , , , . - , , , . , . , , , , , /.

GC.Collect();

, , , , , . , , , .

.NET, , Close() , . , , . . .

+1

All Articles