Beispiel #1
0
        /// <summary>
        /// 查找自动导入按钮
        /// </summary>
        static void ZiDongDaoRu()
        {
            var  bar      = WinApi.FindWindow(null, "开具增值税普通发票");
            var  list     = WinApi.EnumChilWindowsIntptr(bar);
            var  childBar = list[list.Count - 1];
            RECT rect;
            var  handler = new HandleRef(null, childBar);
            var  flag    = WinApi.GetWindowRect(handler, out rect);

            WinApi.ClickLocation(childBar, rect.right - rect.left - 690, 25);
        }
Beispiel #2
0
        /// <summary>
        /// 卷票折扣功能
        /// </summary>
        static void JuanPiaoZheKou()
        {
            Thread.Sleep(3000);

            var bar    = WinApi.FindWindow(null, "开具增值税普通发票(卷票)");
            var child  = WinApi.FindWindowEx(bar, IntPtr.Zero, null, "FPtiankai_new");
            var child1 = WinApi.FindWindowEx(child, IntPtr.Zero, null, null);
            var child2 = WinApi.FindWindowEx(child, child1, null, null);

            RECT      rect;
            HandleRef ptrT = new HandleRef(null, child2);

            WinApi.GetWindowRect(ptrT, out rect);

            WinApi.ClickLocation(child2, rect.right - rect.left - 290, 25); //点击折扣


            Thread.Sleep(500);
            var bar1 = WinApi.FindWindow(null, "添加折扣行");
            var list = WinApi.EnumChilWindowsIntptr(bar1).Select(i => (int)i).ToList();

            if (list == null || list.Count < 7)
            {
                return;
            }



            WinApi.SendMessage((IntPtr)list[6], 0x0C, IntPtr.Zero, "2.5");

            //Thread.Sleep(1000);
            //WinApi.keybd_event(Keys.Tab, 0, 0, 0);
            //Thread.Sleep(1000);
            //WinApi.keybd_event(Keys.Tab, 0, 0, 0);
            //Thread.Sleep(1000);
            //WinApi.keybd_event(Keys.Tab, 0, 0, 0);
            //Thread.Sleep(1000);
            //WinApi.keybd_event(Keys.Enter, 0, 0, 0);

            Thread.Sleep(1000);


            WinApi.PostMessage((IntPtr)list[4], 0x00F5, 0, 0);

            //WinApi.LeftClick((IntPtr)list[4]);
            //WinApi.SendKey((IntPtr)list[4], KeySnap.VK_ENTER);
            //WinApi.ClickLocation((IntPtr) list[4],1,1);



            Console.ReadKey();
        }
Beispiel #3
0
        static void JuanPiaoLuoJi()
        {
            var bar    = WinApi.FindWindow(null, "开具增值税普通发票(卷票)");
            var child  = WinApi.FindWindowEx(bar, IntPtr.Zero, null, "FPtiankai_new");
            var child1 = WinApi.FindWindowEx(child, IntPtr.Zero, null, null);
            var child2 = WinApi.FindWindowEx(child, child1, null, null);

            RECT      rect;
            HandleRef ptrT = new HandleRef(null, child2);

            WinApi.GetWindowRect(ptrT, out rect);

            for (var i = 0; i < 5; i++)
            {
                WinApi.ClickLocation(child2, rect.right - rect.left - 230, 25); //增加行
                Thread.Sleep(1000);
                WinApi.ClickLocation(child2, rect.right - rect.left - 230, 25); //增加行
                Thread.Sleep(1000);
                WinApi.ClickLocation(child2, rect.right - rect.left - 230, 25); //增加行
                Thread.Sleep(1000);
                WinApi.ClickLocation(child2, rect.right - rect.left - 230, 25); //增加行
                Thread.Sleep(1000);
                WinApi.ClickLocation(child2, rect.right - rect.left - 170, 25); //减少行
                Thread.Sleep(1000);
                WinApi.ClickLocation(child2, rect.right - rect.left - 170, 25); //减少行
                Thread.Sleep(1000);
                WinApi.ClickLocation(child2, rect.right - rect.left - 170, 25); //减少行
                Thread.Sleep(1000);
                WinApi.ClickLocation(child2, rect.right - rect.left - 170, 25); //减少行
                Thread.Sleep(1000);
            }


            //收款员测试
            var cc1 = (int)WinApi.FindWindowEx(child1, IntPtr.Zero, null, null);
            //var cc2 = (int)WinApi.FindWindowEx((IntPtr)cc1, IntPtr.Zero, null, null);
            var fpdm = (int)WinApi.FindWindowEx((IntPtr)cc1, IntPtr.Zero, null, "发票代码:");
            var cc3  = (int)WinApi.FindWindowEx((IntPtr)cc1, (IntPtr)fpdm, null, null);
            var cc4  = (int)WinApi.FindWindowEx((IntPtr)cc1, (IntPtr)cc3, null, null);
            var cc5  = (int)WinApi.FindWindowEx((IntPtr)cc4, IntPtr.Zero, null, null);

            WinApi.SendMessage((IntPtr)cc4, 0x0C, (IntPtr)0, "管理员"); //调整税率为传入税率
        }
Beispiel #4
0
        /// <summary>
        /// 电票 添加 减少按钮
        /// </summary>
        static void SearchAddLess()
        {
            var bar    = WinApi.FindWindow(null, "开具增值税电子普通发票");
            var child  = WinApi.FindWindowEx(bar, IntPtr.Zero, null, null);
            var child1 = WinApi.FindWindowEx(child, IntPtr.Zero, null, null);
            var child2 = WinApi.FindWindowEx(child, child1, null, null);

            Console.WriteLine($"bar:{bar},child:{child},child1:{child1},child2:{child2}");
            RECT      rect;
            HandleRef ptrT = new HandleRef(null, child2);

            WinApi.GetWindowRect(ptrT, out rect);
            for (var i = 0; i < 4; i++)
            {
                WinApi.ClickLocation(child2, rect.right - rect.left - 195, 25); //减少行
                Thread.Sleep(1000);
                WinApi.ClickLocation(child2, rect.right - rect.left - 195, 25); //减少
                Thread.Sleep(1000);
                WinApi.ClickLocation(child2, rect.right - rect.left - 250, 25); //减少
                Thread.Sleep(1000);
            }
        }
Beispiel #5
0
        static void SearchInputFail()
        {
            WinApi.GetWindowRect(new HandleRef(null, (IntPtr)1901104), out var rectbefore);
            WinApi.MoveWindow((IntPtr)1901104, 10, 10, 3000, 2000, true);
            WinApi.GetWindowRect(new HandleRef(null, (IntPtr)1901104), out var rectbeafter);



            //Thread.Sleep(60000);
            //var formBar = WinApi.FindWindow(null, "票易通发票助手");
            var winBar      = WinApi.FindWindow(null, "增值税发票税控开票软件(金税盘版) V2.2.34.190728");
            var child1s     = WinApi.EnumChildWindowsCallback(winBar);
            var HmSearchBar = child1s.Find(b => b.szWindowName == "选择发票号码查询" || b.szTextName == "选择发票号码查询").hWnd;
            var childs      = WinApi.FindChildInfo(HmSearchBar);
            var bar         = childs.Find(b => b.szWindowName == "报送状态" || b.szTextName == "报送状态").hWnd;

            //WinApi.ClickLocation(bar, 5, 15);
            WinApi.ClickLocation(bar, 5, 15);

            Thread.Sleep(1000);

            //198352,
            var editControl = UiaHelper.GetUIAutomation().ElementFromHandle(winBar).FindFirst(UIAutomationClient.TreeScope.TreeScope_Descendants,
                                                                                              UiaHelper.GetUIAutomation().CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "198352"));


            //var editControls = UiaHelper.GetUIAutomation().ElementFromHandle(winBar).FindAll(UIAutomationClient.TreeScope.TreeScope_Descendants,
            //    UiaHelper.GetUIAutomation().CreatePropertyCondition(
            //        UIA_PropertyIds.UIA_ControlTypePropertyId,UIA_ControlTypeIds.UIA_EditControlTypeId));

            //for (var i = 0; i < editControls.Length; i++)
            //{
            //    var element = editControls.GetElement(i);
            //    var pt = (IUIAutomationValuePattern)element.GetCurrentPattern(UIA_PatternIds.UIA_ValuePatternId);
            //    if (i == 0)
            //        pt.SetValue("chenchangchenchang");
            //    Console.WriteLine($"CurrentName:{element.CurrentName} ,currentValue:{pt.CurrentValue}");
            //}

            //var child = UiaHelper.GetUIAutomation().ElementFromHandle(winBar).FindAll(
            //    UIAutomationClient.TreeScope.TreeScope_Children,
            //    UiaHelper.GetUIAutomation().CreateTrueCondition());
            //for (var i = 0; i < child.Length; i++)
            //{
            //    Console.WriteLine(child.GetElement(i).CurrentName);
            //}


            //var elements = child.GetElement(1).FindAll(UIAutomationClient.TreeScope.TreeScope_Children,
            //    UiaHelper.GetUIAutomation().CreateTrueCondition());
            //for (var i = 0; i < elements.Length; i++)
            //{
            //    Console.WriteLine(elements.GetElement(i).CurrentName);
            //}

            //var elements = UiaHelper.GetUIAutomation().ElementFromHandle(bar).FindAll(
            //    UIAutomationClient.TreeScope.TreeScope_Descendants,
            //    UiaHelper.GetUIAutomation().CreateTrueCondition());
            //for (var i = 0; i < elements.Length; i++)
            //{
            //    var ele = elements.GetElement(i);
            //    Console.WriteLine(ele.CurrentName);
            //}


            //var element = UiaHelper.GetUIAutomation().ElementFromHandle(bar).FindFirst(
            //    UIAutomationClient.TreeScope.TreeScope_Children,
            //    UiaHelper.GetUIAutomation().CreateTrueCondition());
            //if (element != null)
            //{
            //    var pt = (IUIAutomationLegacyIAccessiblePattern) element.GetCurrentPattern(
            //        patternId: UIA_PatternIds.UIA_LegacyIAccessiblePatternId);
            //    pt.DoDefaultAction();
            //}
        }