当前位置: 首页>>代码示例>>C#>>正文


C# mshtml类代码示例

本文整理汇总了C#中mshtml的典型用法代码示例。如果您正苦于以下问题:C# mshtml类的具体用法?C# mshtml怎么用?C# mshtml使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


mshtml类属于命名空间,在下文中一共展示了mshtml类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToHNode

    static HObject ToHNode(mshtml.IHTMLDOMNode node)
    {
      if (node == null)
        return null;
      //dynamic x = element;
      //Console.WriteLine(MetaTech.Library.ReflectionExtension.ReflectionHelper._P<object>(element.DomElement, "textContent"));
      //var span = element.DomElement as mshtml.IHTMLDOMNode;
      switch (node.nodeType)
      {
        case 3:
          return new HText(node.nodeValue);
        case 1:
          {
            var element = node as mshtml.IHTMLElement;
            var childs = node.childNodes as System.Collections.IEnumerable;
            return new HElement(element.tagName,
              ToHAttribute("id", element.id),
              ToHAttribute("class", element.className),
              ToHAttribute("src", element.getAttribute("src")),
              //ToHAttribute("style", element.getAttribute("style")),
              childs != null ? childs.OfType<mshtml.IHTMLDOMNode>().Select(child => ToHNode(child)) : null
            );
          }
        default:
          return null;

      }
      ////Console.WriteLine(x.textContent);
      ////mshtml.HTMLTextAreaElement
      //return new HElement(element.TagName, 
      //  ToHAttribute("id", element.Id),
      //  ToHAttribute("name", element.Name),
      //  ToHAttribute("class", element.GetAttribute("class")),
      //  ToHAttribute("style", element.Style),
      //  element.Children.OfType<HtmlElement>().Select(e => ToHElement(e)),
      //  ToHAttribute("type", element.DomElement._f(_=>_.GetType().FullName))
      //);


    }
开发者ID:DrReiz,项目名称:DrReiz.Robo-Gamer,代码行数:40,代码来源:WebBotForm.cs

示例2: Bind

 public override void Bind(mshtml.HTMLDocument dom, string rawContent)
 {
     Clean();
     SessionDocument = new HtmlNodeHierarchy(rawContent.AsHtmlDocument().DocumentNode);
     String domDocStr = ("" + (dom as dynamic).documentElement.OuterHtml + "");
     DomDocument = new HtmlNodeHierarchy(domDocStr.AsHtmlDocument().DocumentNode);
 }
开发者ID:ikutsin,项目名称:BinaryAnalysis.Core,代码行数:7,代码来源:StatePageHtmlDomInformationVm.cs

示例3: Bind

 public void Bind(mshtml.HTMLDocument dom)
 {
     Clean();
     var sess = Enumerable.First<FiddlerSessionHolder>(FiddlerHelper.GetSessionsStack());
     //TODO: diff
     SessionDocument = sess.BrowsingResponse.ResponseContent.AsFixedXML();
     String domDocStr = ("" + (dom as dynamic).documentElement.OuterHtml + "");
     DomDocument = domDocStr.AsFixedXML();
 }
开发者ID:ikutsin,项目名称:BinaryAnalysis.Core,代码行数:9,代码来源:FiddlerPageFixedXmlnformationVm.cs

示例4: Bind

 public override void Bind(mshtml.HTMLDocument dom, string content)
 {
     Clean();
     var sess = Enumerable.First<FiddlerSessionHolder>(FiddlerHelper.GetSessionsStack());
     
     //TODO: diff
     SessionDocument = new HtmlNodeHierarchy(sess.BrowsingResponse.ResponseContent.AsHtmlDocument().DocumentNode);
     String domDocStr = ("" + (dom as dynamic).documentElement.OuterHtml + "");
     DomDocument = new HtmlNodeHierarchy(domDocStr.AsHtmlDocument().DocumentNode);
 }
开发者ID:ikutsin,项目名称:BinaryAnalysis.Core,代码行数:10,代码来源:FiddlerPageHtmlDomInformationVm.cs

示例5: WaitForPageReady

 public static void WaitForPageReady(mshtml.IHTMLDocument2 document, int secondWait = 30)
 {
     for (int i = 0; i < secondWait; i++)
     {
         if (document != null && document.readyState.Equals("complete"))
         {
             break;
         }
         System.Console.WriteLine("READY:" + document == null ? "null" : document.readyState);
         System.Threading.Thread.Sleep(1000);
     }
 }
开发者ID:huangchaosuper,项目名称:watf,代码行数:12,代码来源:Common.cs

示例6: getNode

        private static string getNode(mshtml.IHTMLElement node)
        {
            string nodeExpr = node.tagName;
            if (nodeExpr == null)  // Eg. node = #text
                return null;
            if (node.id != "" && node.id != null)
            {
                nodeExpr += "[@id='" + node.id + "']";
                // We don't really need to go back up to //HTML, since IDs are supposed
                // to be unique, so they are a good starting point.
                return "/" + nodeExpr;
            }

            // Find rank of node among its type in the parent
            int rank = 1;
            mshtml.IHTMLDOMNode nodeDom = node as mshtml.IHTMLDOMNode;
            mshtml.IHTMLDOMNode psDom = nodeDom.previousSibling;
            mshtml.IHTMLElement ps = psDom as mshtml.IHTMLElement;
            while (ps != null)
            {
                if (ps.tagName == node.tagName)
                {
                    rank++;
                }
                psDom = psDom.previousSibling;
                ps = psDom as mshtml.IHTMLElement;
            }
            if (rank > 1)
            {
                nodeExpr += "[" + rank + "]";
            }
            else
            { // First node of its kind at this level. Are there any others?
                mshtml.IHTMLDOMNode nsDom = nodeDom.nextSibling;
                mshtml.IHTMLElement ns = nsDom as mshtml.IHTMLElement;
                while (ns != null)
                {
                    if (ns.tagName == node.tagName)
                    { // Yes, mark it as being the first one
                        nodeExpr += "[1]";
                        break;
                    }
                    nsDom = nsDom.nextSibling;
                    ns = nsDom as mshtml.IHTMLElement;
                }
            }
            return nodeExpr;
        }
开发者ID:mradosta,项目名称:thousandpass,代码行数:48,代码来源:XPath.cs

示例7: MouseMoveEventHandler

        private void MouseMoveEventHandler(mshtml.IHTMLEventObj e)
        {
            string preBlock = current_select_block;
            current_select_block = _webBrowser.InvokeScript("getSelectBlockName") as string;

            if (preBlock != current_select_block && current_select_block != " ")
            {
                ctrVM.functionMV.contain.Children.Clear();
                _tabControls.TabContols.SelectedIndex = 1;
                ctrVM.functionMV.initModel(current_select_block);
                //3D객체에 string 전송
                AddMouseMoveEvnet();
            }


        }
开发者ID:KimDongWan,项目名称:Miseng,代码行数:16,代码来源:ScriptView.xaml.cs

示例8: CheckMousePoint

 public static void CheckMousePoint(IntPtr hwnd, ref Point fakeMousePoint, mshtml.IHTMLDocument2 doc)
 {
     int clientWidth = 0;
     int clientHeight = 0;
     int scrollWidth = 0;
     int scrollHeight = 0;
     Random random = new Random();
     if (GetWindowWidthAndHeight(hwnd, doc, ref clientWidth, ref clientHeight, ref scrollWidth, ref scrollHeight) != null)
     {
         if (((fakeMousePoint.X <= 0) || (fakeMousePoint.X >= clientWidth)) && (clientWidth > 8))
         {
             fakeMousePoint.X = random.Next(4, clientWidth - 8);
         }
         if (((fakeMousePoint.Y <= 0) || (fakeMousePoint.Y >= clientHeight)) && (clientHeight > 8))
         {
             fakeMousePoint.Y = random.Next(4, clientHeight - 8);
         }
     }
 }
开发者ID:purplecow,项目名称:AutoBroswer,代码行数:19,代码来源:HtmlUtil.cs

示例9: getXPath

        public static string getXPath(mshtml.IHTMLElement element)
        {
            if (element == null)
                return "";
            mshtml.IHTMLElement currentNode = element;
            ArrayList path = new ArrayList();

            while (currentNode != null)
            {
                string pe = getNode(currentNode);
                if (pe != null)
                {
                    path.Add(pe);
                    //if (pe.IndexOf("@id") != -1)
                    //    break;  // Found an ID, no need to go upper, absolute path is OK
                }
                currentNode = currentNode.parentElement;
            }
            path.Reverse();
            return join(path, "/");
        }
开发者ID:mradosta,项目名称:thousandpass,代码行数:21,代码来源:XPath.cs

示例10: ClickCheckedRect

 public static bool ClickCheckedRect(IntPtr hwnd, mshtml.IHTMLDocument2 doc, string itemName, string tagStr, string indexStr, ref bool isClick, ref Point fakeMousePoint, ClickEvent clickEvent)
 {
     mshtml.IHTMLElement elem = GetCheckedElement(doc, itemName, tagStr, indexStr);
     bool flag = false;
     if (elem != null)
     {
         flag = true;
         Rectangle elementRect = GetElementRect(doc.body, elem);
         isClick = false;
         if ((elementRect.Width > 0) && (elementRect.Height > 0))
         {
             Random random = new Random();
             int num = random.Next(elementRect.Width);
             int num2 = random.Next(elementRect.Height);
             SetMousePoint(hwnd, ref fakeMousePoint, elementRect.X + num, elementRect.Y + num2, doc);
             isClick = isClickElement(hwnd, doc, elem, elementRect.X + num, elementRect.Y + num2, clickEvent);
         }
     }
     if (elem != null)
     {
         Marshal.ReleaseComObject(elem);
     }
     return flag;
 }
开发者ID:purplecow,项目名称:AutoBroswer,代码行数:24,代码来源:HtmlUtil.cs

示例11: HtmlControl

 public HtmlControl(WATF.Core.Page.IPage page, mshtml.IHTMLElement elem)
 {
     this.m_Page = page;
     this.m_HtmlElement = elem;
 }
开发者ID:huangchaosuper,项目名称:watf,代码行数:5,代码来源:HtmlControl.cs

示例12: Range

 internal Range(mshtml.IHTMLTxtRange range)
 {
     msHtmlTxRange = range;
 }
开发者ID:TomRom27,项目名称:LectioDivina,代码行数:4,代码来源:HtmlDocument.cs

示例13: RemoveBIS

 private void RemoveBIS(mshtml.IHTMLElement element)
 {
     if (element.tagName == "B")
     {
         mshtml.IHTMLElement elem1 = element.parentElement;
         if (elem1.tagName == "I")
         {
             mshtml.IHTMLElement elem2 = elem1.parentElement;
             if (elem2.tagName == "SPAN" && elem2.getAttribute("id", 2).ToString() == "advanced_search")
             {
                 elem2.outerHTML = this.targetTerm;
             }
             Marshal.ReleaseComObject(elem2);
         }
         Marshal.ReleaseComObject(elem1);
     }
 }
开发者ID:grefly,项目名称:Buy4,代码行数:17,代码来源:IEModule.cs

示例14: RemoveS

 private void RemoveS(mshtml.IHTMLElement element)
 {
     if (element.tagName == "SPAN" && element.getAttribute("id", 2).ToString() == "advanced_search")
     {
         element.outerHTML = this.targetTerm;
     }
 }
开发者ID:grefly,项目名称:Buy4,代码行数:7,代码来源:IEModule.cs

示例15: RemoveHTML

 private void RemoveHTML(GlobalSettings settings,mshtml.IHTMLTxtRange range)
 {
     mshtml.IHTMLElement element = range.parentElement();
     if (settings.IsHightlightNonVisible)
     {
         if (settings.IsBold)
         {
             if (settings.IsItalic)
             {
                 RemoveBIS(element);
             }
             else
             {
                 RemoveBS(element);
             }
         }
         else
         {
             if (settings.IsItalic)
             {
                 RemoveIS(element);
             }
             else
             {
                 RemoveS(element);
             }
         }
     }
     else
     {
         if (element.offsetTop > Const.NotFound && element.offsetLeft > Const.NotFound && element.offsetHeight > Const.Ok && element.offsetWidth > Const.Ok)
         {
             if (settings.IsBold)
             {
                 if (settings.IsItalic)
                 {
                     RemoveBIS(element);
                 }
                 else
                 {
                     RemoveBS(element);
                 }
             }
             else
             {
                 if (settings.IsItalic)
                 {
                     RemoveIS(element);
                 }
                 else
                 {
                     RemoveS(element);
                 }
             }
         }
     }
     Marshal.ReleaseComObject(element);
 }
开发者ID:grefly,项目名称:Buy4,代码行数:58,代码来源:IEModule.cs


注:本文中的mshtml类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。