Ejemplo n.º 1
0
        /// <summary>
        /// 点击登录按钮--没有实现遮挡问题
        /// </summary>
        static void ClickLogin()
        {
            var loginWin = WinApi.FindWindow(null, "LoginForm");
            var list     = WinApi.EnumChildWindowsCallback(loginWin);
            var loginBtn = list.Find(bar => bar.szWindowName == "登录");

            WinApi.LeftClick(loginBtn.hWnd);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 操作税收分类编码
        /// </summary>
        static void CaoZuoShuiShouFenLeiBianMa()
        {
            //int goodNoSettingHw = (int)WinApi.FindWindow(null, "税收分类编码设置");

            var bar   = WinApi.FindWindow(null, "SysMessageBox");
            var child = (int)WinApi.FindWindowEx(bar, IntPtr.Zero, null, null);

            for (var i = 0; i < 2; i++)
            {
                child = (int)WinApi.FindWindowEx((IntPtr)child, IntPtr.Zero, null, null);
            }
            var child1 = (int)WinApi.FindWindowEx((IntPtr)child, IntPtr.Zero, null, null);
            var child2 = (int)WinApi.FindWindowEx((IntPtr)child, (IntPtr)child1, null, null);

            var child3 = (int)WinApi.FindWindowEx((IntPtr)child2, IntPtr.Zero, null, null);

            WinApi.LeftClick((IntPtr)child3);

            //var stripHw = WinApi.FindWindowEx((IntPtr)goodNoSettingHw, IntPtr.Zero, null, "toolStrip1");
            //Thread.Sleep(200);
            //WinApi.ClickLocation(stripHw, 40, 15); //点击保存


            //修改实际传入的税率
            //var child = WinApi.FindWindowEx((IntPtr)goodNoSettingHw, IntPtr.Zero, null, "*使用税率");
            //var suilvBar = WinApi.FindWindowEx((IntPtr)goodNoSettingHw, child, null, null);

            ////通过索引设置下拉框选项
            //var index = 9;
            //Thread.Sleep(1000);
            //WinApi.SendMessage(suilvBar, 0x014E, (IntPtr)index, ""); //调整税率为传入税率

            //

            //var child = WinApi.FindWindowEx((IntPtr)goodNoSettingHw, IntPtr.Zero, null, "享受优惠政策");
            //var yhzcBar = WinApi.FindWindowEx((IntPtr)goodNoSettingHw, child, null, null);
            //WinApi.LeftClick(yhzcBar);
            //WinApi.SendKey(yhzcBar, 0x26);
            //Thread.Sleep(30);
            //WinApi.SendKey(yhzcBar, 0x0D);

            //Thread.Sleep(300);

            //int index = 2;
            ////设置优惠政策内容
            //var ssflbmBar = WinApi.FindWindowEx((IntPtr)goodNoSettingHw, IntPtr.Zero, null, "税收分类编码");
            //var yhlxBar = WinApi.FindWindowEx((IntPtr)goodNoSettingHw, ssflbmBar, null, null);
            //WinApi.LeftClick(yhlxBar);
            //for (var i = 0; i < index; i++)
            //{
            //    WinApi.SendKey(yhlxBar, 0x28);
            //    Thread.Sleep(300);
            //}
            //WinApi.SendKey(yhlxBar, 0x0D);

            //ReadFile();
        }