Esempio n. 1
0
        public static object QueryValueHtmlDoc(IHTMLDocument2 htmlDoc, HtmlCommand command)
        {
            try
            {
                if (htmlDoc.IsNull())
                {
                    return(null);
                }

                // ensure command is valid and enabled
                if (!htmlDoc.queryCommandSupported(command.Name()))
                {
                    return(null);
                }

                if (!htmlDoc.queryCommandEnabled(command.Name()))
                {
                    return(null);
                }

                return(htmlDoc.queryCommandValue(command.Name()));
            }
            catch (RemotingException) { }
            catch (UnauthorizedAccessException) { }

            return(null);
        }
Esempio n. 2
0
        public static void ExecuteCommandHtmlDoc(IHTMLDocument2 htmlDoc, HtmlCommand command, object data)
        {
            try
            {
                if (htmlDoc.IsNull())
                {
                    return;
                }

                // ensure command is valid and enabled
                if (!htmlDoc.queryCommandSupported(command.Name()))
                {
                    return;
                }

                if (!htmlDoc.queryCommandEnabled(command.Name()))
                {
                    return;
                }

                htmlDoc.execCommand(command.Name(), false, data);
            }
            catch (RemotingException) { }
            catch (UnauthorizedAccessException) { }
        }
Esempio n. 3
0
        public bool IsCommandSupported(string name)
        {
            IHTMLDocument2 doc = (IHTMLDocument2)Browser.Document;

            if (doc == null)
            {
                return(false);
            }

            return(doc.queryCommandSupported(name));
        }
Esempio n. 4
0
 public bool queryCommandSupported(string cmdID)
 {
     return(_innerDoc2.queryCommandSupported(cmdID));
 }