Exemplo n.º 1
0
        public static bool EnumChildWindowsCallback(IntPtr hWnd, IntPtr lParam)
        {
            StringBuilder className = new StringBuilder(256);

            GetClassName(hWnd, className, className.Capacity);
            if (className.ToString() == "ComboBox")
            {
                if (FoundComboHwnd == (IntPtr)0)
                {
                    //MessageBox.Show("ComboBox");
                    FoundComboHwnd = hWnd;
                }
            }

            String text = WindowMessageClass.GetControlText(hWnd);

            if (text == "确定")
            {
                if (FoundButtonHwnd == (IntPtr)0)
                {
                    //MessageBox.Show("确定");
                    FoundButtonHwnd = hWnd;
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        public static void Go(String s)
        {
            FoundComboHwnd  = (IntPtr)0;
            FoundButtonHwnd = (IntPtr)0;
            EnumChildWindows(MonitorThread.HandledHwnd, EnumChildWindowsCallback, (IntPtr)0);

            COMBOBOXINFO info;

            info        = new COMBOBOXINFO();
            info.cbSize = Marshal.SizeOf(info);
            GetComboBoxInfo(FoundComboHwnd, ref info);

            String x = WindowMessageClass.GetControlText(info.hwndEdit);

            x = Path.GetFileNameWithoutExtension(x) + s + Path.GetExtension(x);
            WindowMessageClass.SetControlText(info.hwndEdit, x);

            WindowMessageClass.ClickControl(FoundButtonHwnd);
        }