Debugging a window handle in Winforms

I have a user who keeps getting this error. Is there a tool that handles the window counter that I can use to understand why it keeps getting this error.

System.ComponentModel.Win32Exception: An error occurred while creating the 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 (owner of IWin32Window)

+1


source to share


3 answers


The best counter I know is Taskmgr.exe. Open + Select Columns and check the boxes for User Objects, Grip Count, and GDI Objects.



The general diagnosis is that you are missing the pens and consuming 10,000 of them. Beware of a rootkit leak bug in .NET 2.0 SP1 and .NET 3.5 Graphics.CopyFromScreen () fixed in 3.5 SP1.

+1


source


If the form you are creating overrides WndProc (), be careful that it always calls base.WndProc () during the window creation process.



I inadvertently skipped the call to base.WndProc () in my override and got your stack trace.

+2


source


Maybe this could help:

Unhandled Win32Exception, error while creating window handle

CLR Debugger (DbgCLR.exe)

on the handheld debugger is located at:

"c: \ Program Files \ Microsoft Visual Studio 8 \ SDK \ v2.0 \ GuiDebug \ DbgCLR.exe" 
+1


source







All Articles