T
Tushar
Hi All,
I am using WinForm and .NET 2.2 framework in my application. My application
mainly uses Infragistics WinGrid. I am extending infragistics grid to
support some functionality by adding winform's toolstrip control (which
intern hosted in a User Control) on Grid Headers. The way I extend this grid
is by implementing Infragistic's IUIElementCreationFilter interface. This
interface provides two methods, AfterCreateChildElements and
BeforeCreateChildElements. The issue that I am facing is, when I load grid,
I am getting following error and it kills my application.
"System.ComponentModel.Win32Exception: Error creating window handle".
This error occurs only when I set BackColor property of my user control to
Transparent. If I do not set BackColor or set it to some color my
application just works fine. I checked the number of window handles and also
GDI Object count at the time this error is thrown. Window handle count is
around 500 and GDI Object count is around 125. Also this error does not
occur all the time. In my application I have several modules where I use
infragisitcs WinGrid which in tern calls same implementation of
IUIElementCreationFilter interface and the code work fine for other modules.
I am not able to figure out as to why this issue is occurring sometimes and
what is that causing it.
During my investigation I found that adding user control with BackColor =
Transparent into Grid's control collection invokes OnPaint event handler and
which intern calls AfterCreateChildElements method in recursive way.
AfterCreateChildElements method is called after an element's ChildElements
have been created. The child element's can be repositioned here and/or new
element's can be added.
The stack trace is given below:
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.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.ControlCollection.Add(Control value)
at Orion.Dashboards.DashboardPartControl.ShowAlert(Object sender,
AlertRaisedEventArgs e) in
C:\FRSDev\DevRoot\foundation61\Orion\Source\Common\Orion.Dashboards\Controls\DashboardPartControl.cs:line
1097
at Orion.Dashboards.DashboardPartControl.OnAlertRaised(Object sender,
AlertRaisedEventArgs e) in
C:\FRSDev\DevRoot\foundation61\Orion\Source\Common\Orion.Dashboards\Controls\DashboardPartControl.cs:line
986
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at Fusion.Windows.Forms.VirtualListGrid.RaiseAlert(Exception ex) in
C:\FRSDev\DevRoot\foundation61\Fusion\Source\Presentation\Fusion.Windows.Forms\Widgets\VirtualListGrid.cs:line
1024
at Fusion.Windows.Forms.VirtualListGrid.OnPaint(PaintEventArgs pe) in
C:\FRSDev\DevRoot\foundation61\Fusion\Source\Presentation\Fusion.Windows.Forms\Widgets\VirtualListGrid.cs:line
638
at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs
e, Rectangle rectangle, Region transparentRegion)
at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e,
Rectangle rectangle, Color backColor, Point scrollOffset)
at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e,
Rectangle rectangle)
at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
at
System.Windows.Forms.ScrollableControl.OnPaintBackground(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e,
Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmEraseBkgnd(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32
dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32
x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef
hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32
dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32
x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef
hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.ControlCollection.Add(Control value)
at
Fusion.Windows.Forms.FilteringCreationFilter.AfterCreateChildElements(UIElement
parent) in
C:\FRSDev\DevRoot\foundation61\Fusion\Source\Presentation\Fusion.Windows.Forms\Widgets\FilteringCreationFilter.cs:line
106
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at
Infragistics.Win.UltraWinGrid.RowColRegionIntersectionUIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at
Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at
Infragistics.Win.UltraWinGrid.UltraGridUIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive)
at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean
verify, Boolean syncMouseEntered)
at Infragistics.Win.ControlUIElementBase.get_CurrentCursor()
at Infragistics.Win.UltraControlBase.get_Cursor()
at System.Windows.Forms.Control.WmSetCursor(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
A first chance exception of type 'System.ComponentModel.Win32Exception'
occurred in System.Windows.Forms.dll
A first chance exception of type 'System.ComponentModel.Win32Exception'
occurred in System.Windows.Forms.dll
Error creating window handle.
Please let me know incase anyone has any clue or idea as to how to proceed
on resolving this issue.
Thanks in advance,
-Tushar
I am using WinForm and .NET 2.2 framework in my application. My application
mainly uses Infragistics WinGrid. I am extending infragistics grid to
support some functionality by adding winform's toolstrip control (which
intern hosted in a User Control) on Grid Headers. The way I extend this grid
is by implementing Infragistic's IUIElementCreationFilter interface. This
interface provides two methods, AfterCreateChildElements and
BeforeCreateChildElements. The issue that I am facing is, when I load grid,
I am getting following error and it kills my application.
"System.ComponentModel.Win32Exception: Error creating window handle".
This error occurs only when I set BackColor property of my user control to
Transparent. If I do not set BackColor or set it to some color my
application just works fine. I checked the number of window handles and also
GDI Object count at the time this error is thrown. Window handle count is
around 500 and GDI Object count is around 125. Also this error does not
occur all the time. In my application I have several modules where I use
infragisitcs WinGrid which in tern calls same implementation of
IUIElementCreationFilter interface and the code work fine for other modules.
I am not able to figure out as to why this issue is occurring sometimes and
what is that causing it.
During my investigation I found that adding user control with BackColor =
Transparent into Grid's control collection invokes OnPaint event handler and
which intern calls AfterCreateChildElements method in recursive way.
AfterCreateChildElements method is called after an element's ChildElements
have been created. The child element's can be repositioned here and/or new
element's can be added.
The stack trace is given below:
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.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.ControlCollection.Add(Control value)
at Orion.Dashboards.DashboardPartControl.ShowAlert(Object sender,
AlertRaisedEventArgs e) in
C:\FRSDev\DevRoot\foundation61\Orion\Source\Common\Orion.Dashboards\Controls\DashboardPartControl.cs:line
1097
at Orion.Dashboards.DashboardPartControl.OnAlertRaised(Object sender,
AlertRaisedEventArgs e) in
C:\FRSDev\DevRoot\foundation61\Orion\Source\Common\Orion.Dashboards\Controls\DashboardPartControl.cs:line
986
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at Fusion.Windows.Forms.VirtualListGrid.RaiseAlert(Exception ex) in
C:\FRSDev\DevRoot\foundation61\Fusion\Source\Presentation\Fusion.Windows.Forms\Widgets\VirtualListGrid.cs:line
1024
at Fusion.Windows.Forms.VirtualListGrid.OnPaint(PaintEventArgs pe) in
C:\FRSDev\DevRoot\foundation61\Fusion\Source\Presentation\Fusion.Windows.Forms\Widgets\VirtualListGrid.cs:line
638
at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs
e, Rectangle rectangle, Region transparentRegion)
at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e,
Rectangle rectangle, Color backColor, Point scrollOffset)
at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e,
Rectangle rectangle)
at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
at
System.Windows.Forms.ScrollableControl.OnPaintBackground(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e,
Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmEraseBkgnd(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.IntCreateWindowEx(Int32
dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32
x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef
hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.UnsafeNativeMethods.CreateWindowEx(Int32
dwExStyle, String lpszClassName, String lpszWindowName, Int32 style, Int32
x, Int32 y, Int32 width, Int32 height, HandleRef hWndParent, HandleRef
hMenu, HandleRef hInst, Object pvParam)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.ControlCollection.Add(Control value)
at
Fusion.Windows.Forms.FilteringCreationFilter.AfterCreateChildElements(UIElement
parent) in
C:\FRSDev\DevRoot\foundation61\Fusion\Source\Presentation\Fusion.Windows.Forms\Widgets\FilteringCreationFilter.cs:line
106
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at
Infragistics.Win.UltraWinGrid.RowColRegionIntersectionUIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at
Infragistics.Win.UltraWinGrid.DataAreaUIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at
Infragistics.Win.UltraWinGrid.UltraGridUIElement.VerifyChildElements(ControlUIElementBase
controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive)
at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean
verify, Boolean syncMouseEntered)
at Infragistics.Win.ControlUIElementBase.get_CurrentCursor()
at Infragistics.Win.UltraControlBase.get_Cursor()
at System.Windows.Forms.Control.WmSetCursor(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
A first chance exception of type 'System.ComponentModel.Win32Exception'
occurred in System.Windows.Forms.dll
A first chance exception of type 'System.ComponentModel.Win32Exception'
occurred in System.Windows.Forms.dll
Error creating window handle.
Please let me know incase anyone has any clue or idea as to how to proceed
on resolving this issue.
Thanks in advance,
-Tushar