Ejemplo n.º 1
0
        private static WindowPartten serilize(string str)
        {
            WindowPartten p = new WindowPartten();

            p.Index = Convert.ToInt32(mathResult(str, @"\[(?<num>\d*?)\]", "0"));
            p.Class = mathResult(str, @"@class='(?<cls>.*?)'", null);
            p.Name  = mathResult(str, @"@name='(?<nam>.*?)'", null);
            return(p);
        }
Ejemplo n.º 2
0
        private static int getWindowByParttern(WindowPartten parn)
        {
            var current = User32.FindWindow(parn.Class, parn.Name);

            if (parn.NextLevel != null)
            {
                return(getSubWindow(parn.NextLevel, current));
            }
            else
            {
                return(current);
            }
        }
Ejemplo n.º 3
0
        private static int getSubWindow(WindowPartten parn, int parentPtr)
        {
            var currentPar = User32.FindWindowEx((IntPtr)parentPtr, IntPtr.Zero, parn.Class, null);

            if (parn.Index > 0)
            {
                for (int idx = 1; idx <= parn.Index; idx++)
                {
                    currentPar = User32.FindWindowEx((IntPtr)parentPtr, (IntPtr)currentPar, parn.Class, null);
                }
            }
            if (parn.NextLevel == null)
            {
                return(currentPar);
            }
            else
            {
                return(getSubWindow(parn.NextLevel, currentPar));
            }
        }