Inheritance: IWin32Window
 public MapBasicWindowForm(Win32Window mapbasicWindow)
 {
     InitializeComponent();
     _mapBasicWindow = mapbasicWindow;
     //Resize += new EventHandler(MapBasicWindowForm_Resize);
     //MapBasicWindowForm_Load();
 }
        public DockableWindowForm(Win32Window mapInfoWindow, string name)
        {
            InitializeComponent();
            ConfigureDockableWindow(mapInfoWindow, name, "");

            //_window = mapInfoWindow;

            //if (name != "")
            //{
            //    _sDockInfoXMLFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
            //                        + "\\MapInfo\\MapInfo\\" + name + ".xml";

            //    _controllerMutex = new Mutex(false, name);
            //}

            //_miApp = InteropServices.MapInfoApplication;
            //// Register the window with the docking system
            ////_dockWindow = _miApp.RegisterDockWindow(_window.Handle);
            //_dockWindow = _miApp.RegisterDockWindow(this.Handle);

            //_dockWindow.Title = _window.Title;
            //DockableWindowForm_Load();

            //SetDockPosition();
        }
        public DockableWindowForm(Win32Window mapInfoWindow)
        {
            InitializeComponent();
            ConfigureDockableWindow(mapInfoWindow, "", "");

            //_window = mapInfoWindow;

            //_miApp = InteropServices.MapInfoApplication;

            //// Register the window with the docking system
            ////_dockWindow = _miApp.RegisterDockWindow(_window.Handle);
            //_dockWindow = _miApp.RegisterDockWindow(this.Handle);

            //_dockWindow.Title = _window.Title;
            //DockableWindowForm_Load();

            //SetDockPosition();
        }
        public static void MapBasicWindowShow()
        {
            Win32Window mapbasicwindow = new Win32Window((int)Win32Window.WindowType.WIN_MAPBASIC);
            if (!mapbasicwindow.IsOpen)
            {
                // Open the mapbasic window.
                InteropHelper.Do("Run Menu Command 608");
            }
            if ((_mapbasicWindow == null) || (_mapbasicWindow.IsDisposed))
            {
                //MessageBox.Show("1");
                _mapbasicWindow = new MapBasicWindowForm(new MapBasicWindowController(), mapbasicwindow);
                //MessageBox.Show("2");
                _miApp = InteropServices.MapInfoApplication;
                // Register the window with the docking system
                //MessageBox.Show("3");
                _dockWindow = _miApp.RegisterDockWindow(_mapbasicWindow.Handle);
                //MessageBox.Show("4");
                _mapbasicWindow.SetDockPosition();

                //MessageBox.Show("5");
                _dockWindow.Title = "MapBasic Window";

                //_mapbasicWindow.EnableDockChangedEvent();
            }
            else
            {
                _dockWindow.Activate();
            }
        }
        private void ConfigureDockableWindow(Win32Window mapInfoWindow, string name, string windowTitle)
        {
            _window = mapInfoWindow;

            if (name != "")
            {
                _sDockInfoXMLFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
                                    + "\\MapInfo\\MapInfo\\" + name + ".xml";
                _controllerMutex = new Mutex(false, name);
            }

            _miApp = InteropServices.MapInfoApplication;
            // Register the window with the docking system
            _dockWindow = _miApp.RegisterDockWindow(this.Handle);

            //Setting the title of the dockable window
            if (windowTitle == "" || windowTitle == null)
                _dockWindow.Title = _window.Title;
            //_dockWindow.Title = _window.Name;
            else
                _dockWindow.Title = windowTitle;

            DockableWindowForm_Load();

            SetDockPosition();
        }