jackallread

Unable to get the window handle for the 'AxToolbarControl' control

Discussion created by jackallread on May 19, 2010
Latest reply on Dec 3, 2010 by jackallread
I have an ArcGIS 10 application I am coding in VB.NET 2008. I have added a MapControl and a AxToolbarControl to the form with the MapControl being a buddy of the toolbar. The form is instantiated as a MDIChild of the main form. I have a feature that removes the MDIChild from the main form and moves it to a second monitor. This function worked fine when I had the MapControl alone, but when I added the toolbar control I get the error shown at the bottom of this message. This error occurs when the following line is executed:

Me.MdiParent = Nothing

The error shows up as the MDIChild form not showing up in the second monitor with no error being thrown. I had to click on Debug|Exceptions menus items then chck "Thrown" for all exception types to capture the error.

I have been able to find that similar errors occurred in an earlier version of ArcObjects and I was wondering if that may have cropped up again?

I tried placing the control in a panel, but that didn't help.

Thanks,
Jack

-----------------------------------------------------------------
ArcGIS 10 ArcObjects

ERROR
{"Unable to get the window handle for the 'AxToolbarControl' control. Windowless ActiveX controls are not supported."}

STACK TRACE
at System.Windows.Forms.AxHost.InPlaceActivate()
   at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
   at System.Windows.Forms.AxHost.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(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.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.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.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
   at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Form.set_MdiParentInternal(Form value)
   at System.Windows.Forms.Form.set_MdiParent(Form value)
   at V5UI.MapWindow.MoveToSecondMonitor() in P:\Projects\VS.NET 2008\V5UI\V5UI\Windows\MapWindow.vb:line 190
  
InnerException.Message
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Outcomes