Ejemplo n.º 1
0
        private void InstallHTMLHooks(Win32HookMsgEventArgs evt)
        {
            String       searchCondition   = String.Format("{0}!=1", CatStudioConstants.HOOKED_BY_REC_ATTR);
            IElementList rootElemNotHooked = this.twebstBrowser.FindAllElements("html", searchCondition);

            try
            {
                for (int i = 0; i < rootElemNotHooked.length; ++i)
                {
                    IElement       crntElem = rootElemNotHooked[i];
                    IHTMLDocument3 doc3     = (IHTMLDocument3)crntElem.nativeElement.document;
                    IHTMLWindow2   wnd      = ((IHTMLDocument2)doc3).parentWindow;

                    doc3.attachEvent("onclick", new HtmlHandler(this.OnHtmlClick, wnd));
                    doc3.attachEvent("onmouseup", new HtmlHandler(this.OnHtmlMouseUp, wnd));
                    crntElem.SetAttribute(CatStudioConstants.HOOKED_BY_REC_ATTR, "1");
                }

                InstallHTMLHooksForOnchange();
            }
            catch
            {
                // Can not properly install html hooks.
            }
        }
Ejemplo n.º 2
0
        private void HookIntroPage()
        {
            try
            {
                IWebBrowser2   nativeBrowser = (SHDocVw.IWebBrowser2)webBrowser.ActiveXInstance;
                IHTMLDocument3 introDoc      = nativeBrowser.Document as IHTMLDocument3;

                if (introDoc != null)
                {
                    introDoc.attachEvent("onclick", new HtmlHandler(this.OnIntroClick, ((IHTMLDocument2)introDoc).parentWindow));

                    // Initialize checkbox with value in registry.
                    IHTMLInputElement checkBox          = (IHTMLInputElement)introDoc.getElementById(CatStudioConstants.INTRO_DONT_ASK_AGAIN_ATTR);
                    RegistryKey       twbstStudioRegKey = Registry.CurrentUser.OpenSubKey("Software\\Codecentrix\\OpenTwebst\\Studio", false);

                    if (twbstStudioRegKey != null)
                    {
                        int dontShowIntro = (int)twbstStudioRegKey.GetValue("dontshowintro", 0);

                        checkBox.@checked = (dontShowIntro != 0);
                        twbstStudioRegKey.Close();
                    }
                }
            }
            catch
            {
                // Do nothing. Maybe not this critical.
            }
        }
Ejemplo n.º 3
0
        protected virtual void RegisterEvents()
        {
            IHTMLDocument3 doc3 = this._document as IHTMLDocument3;

            if (doc3 != null)
            {
                doc3.attachEvent("onpropertychange", this);
            }
        }