public bool DeactivateDesigner()
        {
            bool bret = false;

            if (m_pDoc2 == null)
            {
                return(bret);
            }
            IfacesEnumsStructsClasses.IServiceProvider pSp = m_pDoc2 as IfacesEnumsStructsClasses.IServiceProvider;
            if (pSp == null)
            {
                return(bret);
            }

            IntPtr pout = IntPtr.Zero;
            int    hr   = pSp.QueryService(ref Iid_Clsids.SID_SHTMLEditServices,
                                           ref Iid_Clsids.IID_IHTMLEditServices, out pout);

            if (pout == IntPtr.Zero)
            {
                return(bret);
            }

            IHTMLEditServices pEs = Marshal.GetObjectForIUnknown(pout) as IHTMLEditServices;

            if (pEs == null)
            {
                return(bret);
            }

            pEs.RemoveDesigner(this);

            return(true);
        }
        public bool ActivateDesigner(IHTMLDocument2 pDoc2)
        {
            m_pDoc2 = pDoc2;
            bool bret = false;

            IfacesEnumsStructsClasses.IServiceProvider pSp = pDoc2 as IfacesEnumsStructsClasses.IServiceProvider;
            if (pSp == null)
            {
                return(bret);
            }

            IntPtr pout = IntPtr.Zero;
            int    hr   = pSp.QueryService(ref Iid_Clsids.SID_SHTMLEditServices,
                                           ref Iid_Clsids.IID_IHTMLEditServices, out pout);

            if (pout == IntPtr.Zero)
            {
                return(bret);
            }

            IHTMLEditServices pEs = Marshal.GetObjectForIUnknown(pout) as IHTMLEditServices;

            if (pEs == null)
            {
                return(bret);
            }

            //Add to desiners
            pEs.AddDesigner(this);

            return(true);
        }