예제 #1
0
        public void CreateDocument()
        {
            Debug.Assert(m_document == null, "Must call Close before recreating.");

            Boolean created = false;

            try
            {
                m_document = (IOleObject) new mshtml.HTMLDocument();

                int iRetval = ComSupport.OleRun(m_document);


                m_document.SetClientSite(this);

                // Lock the object in memory
                iRetval = ComSupport.OleLockRunning(m_document, true, false);

                m_document.SetHostNames("HtmlEditor", "HtmlEditor");
                m_document.Advise(this, out iAdviseCookie);

                created = true;
            }
            finally
            {
                if (created == false)
                {
                    m_document = null;
                }
            }
        }
예제 #2
0
        public void CreateDocument()
        {
            Debug.Assert(m_document == null, "Must call Close before recreating.");

            Boolean created = false;

            try
            {
                m_document = (IOleObject) new HTMLDocument();

                int iRetval;

                iRetval = win32.OleRun(m_document);

                iRetval = m_document.SetClientSite(this);

                Debug.Assert(iRetval == HRESULT.S_OK, "SetClientSite failed");

                // Lock the object in memory
                iRetval = win32.OleLockRunning(m_document, true, false);

                m_document.SetHostNames("HtmlEditor", "HtmlEditor");
                m_document.Advise(this, out iAdviseCookie);

                //hook up HTMLDocumentEvents2
                Guid guid = new Guid("3050f613-98b5-11cf-bb82-00aa00bdce0b");
                IConnectionPointContainer icpc = (IConnectionPointContainer)m_document;

                icpc.FindConnectionPoint(ref guid, out icp);
                icp.Advise(this, out iEventsCookie);

                created = true;
            }
            finally
            {
                if (created == false)
                {
                    m_document = null;
                }
            }
        }
예제 #3
0
파일: HtmlSite.cs 프로젝트: gahadzikwa/GAPP
        public void CreateDocument()
        {
            Debug.Assert(m_document == null, "Must call Close before recreating.");

            Boolean created = false;
            try
            {
                m_document = (IOleObject)new HTMLDocument();

                int iRetval;

                iRetval = win32.OleRun(m_document);

                iRetval = m_document.SetClientSite(this);

                Debug.Assert(iRetval == HRESULT.S_OK, "SetClientSite failed");

                // Lock the object in memory
                iRetval = win32.OleLockRunning(m_document, true, false);

                m_document.SetHostNames("HtmlEditor", "HtmlEditor");
                m_document.Advise(this, out iAdviseCookie);

                //hook up HTMLDocumentEvents2
                Guid guid = new Guid("3050f613-98b5-11cf-bb82-00aa00bdce0b");
                IConnectionPointContainer icpc = (IConnectionPointContainer)m_document;

                icpc.FindConnectionPoint(ref guid, out icp);
                icp.Advise(this, out iEventsCookie);

                created = true;
            }
            finally
            {
                if (created == false)
                    m_document = null;
            }
        }