Ejemplo n.º 1
0
        /// <summary>
        /// 在WINDOWS任务管理器里隐藏一行 需要一直调用 会被任务管理器刷新出来
        /// </summary>
        /// <param name="p_Name">名称 如QQ.exe</param>
        public void HideTaskmgrListOfName(string p_Name)
        {
            System.Diagnostics.Process[] _ProcessList = System.Diagnostics.Process.GetProcessesByName("taskmgr");
            for (int i = 0; i != _ProcessList.Length; i++)
            {
                if (_ProcessList[i].MainWindowTitle == "Windows 任务管理器")
                {
                    m_ProcessID = _ProcessList[i].Id;
                    Win32API.EnumWindowsProc _EunmControl = new Win32API.EnumWindowsProc(NetEnumControl);

                    Win32API.EnumChildWindows(_ProcessList[i].MainWindowHandle, _EunmControl, 0);
                }
            }
        }
Ejemplo n.º 2
0
        public static IntPtr GetPriceTipInfoAndClickYes(IntPtr hWnd)
        {
            IntPtr tipInfoWindow = IntPtr.Zero;

            Win32API.EnumWindowsProc EnumWindowsProc = delegate(IntPtr p, int lParam)
            {
                if (p != IntPtr.Zero)
                {
                    String text  = GetWindowText(p);
                    String clazz = GetClassName(p);

                    if (clazz == "#32770" && text == "")
                    {
                        Console.WriteLine("寻找价格提示窗口:{0}", Convert.ToString(p.ToInt64(), 16));
                        IntPtr hParent = Win32API.GetParent(p);
                        String pText   = GetWindowText(hParent);
                        if (pText == @"网上股票交易系统5.0")
                        {
                            int    staticId = 0x0410;
                            IntPtr pStatic  = Win32API.GetDlgItem(p, staticId);
                            if (pStatic != IntPtr.Zero)
                            {
                                tipInfoWindow = p;

                                String sText = GetWindowText(pStatic);
                                if (sText == "委托价格的小数部分应为 2 位,是否继续?")
                                {
                                    int    btnYesId = 0x0006;
                                    IntPtr btnYes   = Win32API.GetDlgItem(p, btnYesId);
                                    Win32API.SendMessage(btnYes, Win32Code.WM_SETFOCUS, 0, 0);
                                    Win32API.SendMessage(btnYes, Win32Code.WM_LBUTTONDOWN, 0, 0);
                                    Win32API.SendMessage(btnYes, Win32Code.WM_LBUTTONUP, 0, 0);
                                    Win32API.SendMessage(btnYes, Win32Code.WM_LBUTTONDOWN, 0, 0);
                                    Win32API.SendMessage(btnYes, Win32Code.WM_LBUTTONUP, 0, 0);
                                }
                            }
                        }
                    }
                    return(true);
                }

                return(false);
            };

            Win32API.EnumChildWindows(IntPtr.Zero, EnumWindowsProc, new IntPtr(100));

            return(tipInfoWindow);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取成交提示
        /// </summary>
        /// <param name="hWnd"></param>
        /// <returns></returns>
        public static IntPtr GetEntrustTips(IntPtr hWnd)
        {
            IntPtr confirmWindow = IntPtr.Zero;

            Win32API.EnumWindowsProc EnumWindowsProc = delegate(IntPtr p, int lParam)
            {
                if (p != IntPtr.Zero)
                {
                    String text  = GetWindowText(p);
                    String clazz = GetClassName(p);

                    if (clazz == "#32770" && text == "")
                    {
                        IntPtr hParent = Win32API.GetParent(p);
                        String pText   = GetWindowText(hParent);
                        if (pText == @"网上股票交易系统5.0")
                        {
                            int    staticId = 0x03EC;
                            IntPtr pStatic  = Win32API.GetDlgItem(p, staticId);
                            if (pStatic != IntPtr.Zero)
                            {
                                confirmWindow = p;

                                String sText = GetWindowText(pStatic);

                                // 检查static label, 获取合同编号
                                Console.WriteLine("IntPtr: {2}, text: {0}, clazz: {1}====Parent Ptr: {3}, Text;{4}", text, clazz, Convert.ToString(p.ToInt32(), 16), hParent, pText);
                                Console.WriteLine("text: {0}, Ptr{1}", sText, Convert.ToString(pStatic.ToInt32(), 16));
                            }
                        }
                    }
                    return(true);
                }

                return(false);
            };

            Win32API.EnumChildWindows(hWnd, EnumWindowsProc, new IntPtr(100));

            return(confirmWindow);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取成交提示
        /// </summary>
        /// <param name="hWnd"></param>
        /// <returns></returns>
        public static String GetEntrustTipsAndClickYes(IntPtr hWnd)
        {
            string no            = "0";
            IntPtr confirmWindow = IntPtr.Zero;

            Win32API.EnumWindowsProc EnumWindowsProc = delegate(IntPtr p, int lParam)
            {
                if (p != IntPtr.Zero)
                {
                    String text  = GetWindowText(p);
                    String clazz = GetClassName(p);

                    if (clazz == "#32770" && text == "")
                    {
                        IntPtr hParent = Win32API.GetParent(p);
                        String pText   = GetWindowText(hParent);
                        if (pText == @"网上股票交易系统5.0")
                        {
                            int    staticId = 0x03EC;
                            IntPtr pStatic  = Win32API.GetDlgItem(p, staticId);
                            if (pStatic != IntPtr.Zero)
                            {
                                confirmWindow = p;
                                byte[] lParamStr = new byte[100];
                                Win32API.SendMessage(pStatic, Win32Code.WM_GETTEXT, 100, lParamStr);
                                String sText = Encoding.Unicode.GetString(lParamStr);
                                Console.WriteLine("找到委托提示窗口:{0}, 合同:{1}", Convert.ToString(p.ToInt64(), 16), sText);
                                if (sText.Contains("委托已成功提交"))
                                {
                                    int i = sText.IndexOf("。");
                                    no = sText.Substring(17, i - 17);
                                    int    btnYesId = 0x0002;
                                    IntPtr btnYes   = Win32API.GetDlgItem(p, btnYesId);

                                    //int pbId;
                                    //Win32API.GetWindowThreadProcessId(btnYes, out pbId);
                                    POINT pt = new POINT();
                                    pt.x = 1;
                                    pt.y = 1;
                                    Win32API.SendMessage(btnYes, Win32Code.WM_SETFOCUS, 0, 0);
                                    Win32API.PostMessage(btnYes, Win32Code.WM_MOUSEMOVE, 0, ref pt);
                                    Win32API.PostMessage(btnYes, Win32Code.WM_LBUTTONDOWN, 0, ref pt);
                                    Win32API.PostMessage(btnYes, Win32Code.WM_LBUTTONUP, 0, ref pt);
                                    Win32API.PostMessage(btnYes, Win32Code.WM_LBUTTONDOWN, 0, ref pt);
                                    Win32API.PostMessage(btnYes, Win32Code.WM_LBUTTONUP, 0, ref pt);
                                    //Win32API.keybd_event(13, 0, 0, pbId);
                                    //Win32API.keybd_event(13, 0, 2, pbId);

                                    Win32API.SendMessage(btnYes, Win32Code.WM_SETFOCUS, 0, 0);
                                    Win32API.SendMessage(btnYes, Win32Code.WM_LBUTTONDOWN, 0, 0);
                                    Win32API.SendMessage(btnYes, Win32Code.WM_LBUTTONUP, 0, 0);
                                    Win32API.SendMessage(btnYes, Win32Code.WM_LBUTTONDOWN, 0, 0);
                                    Win32API.SendMessage(btnYes, Win32Code.WM_LBUTTONUP, 0, 0);
                                }
                            }
                        }
                    }
                    return(true);
                }

                return(false);
            };

            Win32API.EnumChildWindows(IntPtr.Zero, EnumWindowsProc, new IntPtr(100));

            return(no);
        }