Ejemplo n.º 1
0
        private static bool CheckByName(IntPtr hWnd, String name)
        {
            int           length     = WinAPI.GetWindowTextLength(hWnd);
            StringBuilder windowName = new StringBuilder(length + 1);

            WinAPI.GetWindowText(hWnd, windowName, windowName.Capacity);

            StringBuilder className = new StringBuilder(length + 1000);

            WinAPI.GetClassName(hWnd, className, className.Capacity);

            //Console.WriteLine(string.Format("{0} {1} {2}", hWnd.ToString("x8"), className, windowName));

            if (className.ToString() != "Button")
            {
                return(false);
            }

            uint processid = 0;

            WinAPI.GetWindowThreadProcessId(hWnd, out processid);
            if (windowName.ToString().Replace("&", "") == name)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        public static ComboBox CreateByIndex(IntPtr hWnd, IntPtr hWndWin, int indexBaseZero, ref int currIndex)
        {
            int           length    = WinAPI.GetWindowTextLength(hWnd);
            StringBuilder className = new StringBuilder(length + 1000);

            WinAPI.GetClassName(hWnd, className, className.Capacity);

            uint processid = 0;

            WinAPI.GetWindowThreadProcessId(hWnd, out processid);

            //Console.WriteLine(string.Format("{0} {1}", hWnd.ToString("x8"), className));

            if (className.ToString() != "ComboBox")
            {
                return(null);
            }

            if (currIndex != indexBaseZero)
            {
                currIndex++;
                return(null);
            }

            return((ComboBox)Activator.CreateInstance(typeof(ComboBox), hWnd, hWndWin, string.Format("Index[{0}]", indexBaseZero)));
        }
Ejemplo n.º 3
0
        internal static string GetWinClass(IntPtr hWnd)
        {
            StringBuilder className = new StringBuilder(1000);

            WinAPI.GetClassName(hWnd, className, className.Capacity);

            return(className.ToString());
        }
Ejemplo n.º 4
0
        public static ToolbarButton CreateByIndex(IntPtr hWnd, IntPtr hWndWin, int indexBaseZero, ref int currIndex)
        {
            int           length    = WinAPI.GetWindowTextLength(hWnd);
            StringBuilder className = new StringBuilder(length + 1000);

            WinAPI.GetClassName(hWnd, className, className.Capacity);

            uint processid = 0;

            WinAPI.GetWindowThreadProcessId(hWnd, out processid);

            if (className.ToString() != "ToolbarWindow32")
            {
                return(null);
            }

            WinAPI.TBBUTTON tb = new WinAPI.TBBUTTON();
            WinAPI.GetToolbarButton(hWnd, indexBaseZero, ref tb);

            return((ToolbarButton)Activator.CreateInstance(typeof(ToolbarButton), hWnd, hWndWin, string.Format("ToolbarButton[{0}]", indexBaseZero), tb.idCommand));
        }