示例#1
0
        public static IntPtr FindChildWindowByClassName(IntPtr parenthWnd, string className)
        {
            List <IntPtr> list       = AppManipulation.GetChildWindows(parenthWnd);
            string        listString = String.Empty;
            int           nRet;
            IntPtr        match = IntPtr.Zero;
            int           count = 0;

            foreach (IntPtr item in list)
            {
                StringBuilder ClassName = new StringBuilder(100);
                nRet = AppManipulation.GetClassName(item, ClassName, ClassName.Capacity);
                if (nRet != 0)
                {
                    if (className.ToString() == className)
                    {
                        if (match == IntPtr.Zero)
                        {
                            match = item;
                        }
                        Console.WriteLine(count.ToString() + " " + className + " " + item.ToString("X8"));
                        count++;
                    }
                }
            }
            return(match);
        }
示例#2
0
        public static IntPtr FindLastChildWindowByClassName(IntPtr parenthWnd, string className)
        {
            List <IntPtr> list = AppManipulation.GetChildWindows(parenthWnd);

            if (list.Count > 0)
            {
                return(list[list.Count - 1]);
            }
            return(IntPtr.Zero);
        }
示例#3
0
        public static IntPtr FindChildWindowByClassNameByIndex(IntPtr parenthWnd, string className, int index)
        {
            List <IntPtr> list = AppManipulation.GetChildWindows(parenthWnd);

            if (index < list.Count)
            {
                return(list[index]);
            }
            return(IntPtr.Zero);
        }
示例#4
0
 public static void WriteInNotepad(string text)
 {
     AppManipulation.SetText(AppManipulation.FindChildWindowByClassName(AppManipulation.FindWindowByWindowName("Untitled - Notepad"), "Edit"), text);
 }
示例#5
0
        public static int FindChildWindowCountByClassName(IntPtr parenthWnd, string className)
        {
            List <IntPtr> list = AppManipulation.GetChildWindows(parenthWnd);

            return(list.Count);
        }