我想搞自动录入,但是程序取不了IE窗口的句柄,录入不了消息到网页的输入框啊
不能用WebBrowser,因为有点特别的原因,只能是把网页打开了,再用我的软件录入

解决方案 »

  1.   

     public delegate bool EnumWindowsProc(IntPtr p_Handle, int p_Param);       [DllImport("user32.dll")]
            public static extern int EnumWindows(EnumWindowsProc ewp, int lParam);使用这两个API就可以了.
      

  2.   

    能写个最简单的例子给我吗,上面的那两个API是否先取到任务栏上的东西,再逐个判断是否IE?
      

  3.   

    没错,用那两个API,可以枚举浏览器,包括你打开的WINDOWS窗口
      

  4.   

      public delegate bool EnumWindowsProc(IntPtr p_Handle, int p_Param);        [DllImport("user32.dll")]
            public static extern int EnumWindows(EnumWindowsProc ewp, int lParam);        [DllImport("User32.dll", CharSet = CharSet.Auto)]
            public static extern int GetClassName(IntPtr hWnd, StringBuilder ClassName, int nMaxCount);        private void button1_Click(object sender, EventArgs e)
            {
                EnumWindowsProc _Proc = new EnumWindowsProc(GetWindows);            EnumWindows(_Proc, 0);        }
            IList<IntPtr> _WindowsList = new List<IntPtr>();
                
            public bool GetWindows(IntPtr p_Handle, int p_Param)
            {
                StringBuilder _ClassName = new StringBuilder(255);
                GetClassName(p_Handle, _ClassName, 255);
                if (_ClassName.ToString() == "IEFrame") _WindowsList.Add(p_Handle);
                return true;
            }
      

  5.   

    我试了,但取出了这些tooltips_class32,TXGuiFoundation  Shell_trayWnd 这些,就是没有IEFrame这东西