Ejemplo n.º 1
0
        public static bool isClickElement(IntPtr hwnd, mshtml.IHTMLDocument2 doc, mshtml.IHTMLElement ele, int x, int y, ClickEvent clickEvent)
        {
            bool flag = false;

            clickEvent.SetElement(ele);
            WindowUtil.ClickMouse(hwnd, x, y);
            if (clickEvent.CouldClick)
            {
                if (clickEvent.IsClick)
                {
                    flag = true;
                }
                return(flag);
            }
            mshtml.IHTMLElement parentElement = ele;
            mshtml.IHTMLElement activeElement = doc.activeElement;
            while ((parentElement != null) && (parentElement != doc.body))
            {
                if (parentElement == activeElement)
                {
                    flag = true;
                    break;
                }
                parentElement = parentElement.parentElement;
            }
            if (!flag)
            {
                parentElement = ele;
                for (activeElement = doc.activeElement; (activeElement != null) && (activeElement != doc.body); activeElement = activeElement.parentElement)
                {
                    if (parentElement == activeElement)
                    {
                        return(true);
                    }
                }
            }
            return(flag);
        }
Ejemplo n.º 2
0
 public static bool isClickElement(IntPtr hwnd, mshtml.IHTMLDocument2 doc, mshtml.IHTMLElement ele, int x, int y, ClickEvent clickEvent)
 {
     bool flag = false;
     clickEvent.SetElement(ele);
     WindowUtil.ClickMouse(hwnd, x, y);
     if (clickEvent.CouldClick)
     {
         if (clickEvent.IsClick)
         {
             flag = true;
         }
         return flag;
     }
     mshtml.IHTMLElement parentElement = ele;
     mshtml.IHTMLElement activeElement = doc.activeElement;
     while ((parentElement != null) && (parentElement != doc.body))
     {
         if (parentElement == activeElement)
         {
             flag = true;
             break;
         }
         parentElement = parentElement.parentElement;
     }
     if (!flag)
     {
         parentElement = ele;
         for (activeElement = doc.activeElement; (activeElement != null) && (activeElement != doc.body); activeElement = activeElement.parentElement)
         {
             if (parentElement == activeElement)
             {
                 return true;
             }
         }
     }
     return flag;
 }