Reputation: 196459
I have a user that keeps getting this error. Is there a tool that does window handle counting that i can use to figure out why he keeps getting this error.
System.ComponentModel.Win32Exception: Error creating window handle. at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp) at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.Form.CreateHandle() at System.Windows.Forms.Control.get_Handle() at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
Upvotes: 1
Views: 2742
Reputation: 1437
If the Form you are creating overrides WndProc(), be careful to ensure that it always calls base.WndProc() during the window creation process.
I inadvertently omitted a call to base.WndProc() in my override, and got your stack trace.
Upvotes: 2
Reputation: 941307
The best counter I know is Taskmgr.exe. View + Select Columns and check "User objects", "Handle count" and "GDI Objects".
The generic diagnostic is that you're leaking handles and consumed 10,000 of them. Beware of a handle leak bug in .NET 2.0 SP1 and .NET 3.5's Graphics.CopyFromScreen(), fixed in 3.5 SP1.
Upvotes: 1
Reputation: 4688
Maybe this could help:
Unhandled exception Win32Exception,Error creating window handle
on mine machine debugger is located at:
"c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\GuiDebug\DbgCLR.exe"
Upvotes: 1