/// <summary> /// 专票地址信息填写 /// </summary> static bool ZhuanPiaoInfo() { string pageName = "开具增值税专用发票"; var bar = WinApi.FindWindow(null, pageName); if (bar == IntPtr.Zero) { return(false); } var list = WinApi.EnumChilWindowsIntptr(bar).Select(ptr => (int)ptr).ToList(); //var grandparent = WinApi.GetParent((IntPtr) list[list.Count - 1]); //var parent = (int)WinApi.FindWindowEx(grandparent, IntPtr.Zero, null, null); //var parent2 = (int)WinApi.FindWindowEx((IntPtr)parent, IntPtr.Zero, null, null); var list2 = WinApi.FindChildBar((IntPtr)list[2]); var list3 = WinApi.FindChildBar(list2[19]); var list4 = WinApi.FindChildBar(list2[21]); for (var i = 0; i < list3.Count; i++) { WinApi.SendMessage(list3[i], 0x0C, IntPtr.Zero, "6217920170878354"); StringBuilder sb = new StringBuilder(); //获取文本 WinApi.GetWindowTextW(list3[i], sb, 255); var str = sb.ToString(); } for (var i = 0; i < list4.Count; i++) { WinApi.SendMessage(list4[i], 0x0C, IntPtr.Zero, "xinjiapo 15721527020"); } var accountBar1 = WinApi.FindWindowEx((IntPtr)list2[list2.Count - 4], IntPtr.Zero, null, null); var accountBar2 = WinApi.FindWindowEx((IntPtr)list2[list2.Count - 4], accountBar1, null, null); //WinApi.SendMessage(accountBar, 0x0C, IntPtr.Zero, "6217720678878325"); if (list == null || list.Count < 37) { return(false); } WinApi.SendMessage((IntPtr)list[list.Count - 5], 0x0C, IntPtr.Zero, "shanghai..."); Thread.Sleep(500); //WinApi.SendMessage((IntPtr)list[37], 0x0C, IntPtr.Zero, "6217720678878325"); WinApi.SendMessage((IntPtr)list[list.Count - 9], 0x0C, IntPtr.Zero, "6217720678878325"); return(true); }
/// <summary> /// 最大最小化 /// </summary> static void ShowWindow() { var winBar = WinApi.FindWindow(null, "Form1Text"); var childs = WinApi.FindChildBar(winBar); WinApi.SendMessage(childs[childs.Count - 1], 0x0C, IntPtr.Zero, "chenchang"); for (var i = 0; i < 1; i++) { WinApi.ShowWindow(winBar, 2); //最小 Thread.Sleep(1000); WinApi.ShowWindow(winBar, 3); //最大 Thread.Sleep(1000); } }
/// <summary> /// 专票红冲改动 /// </summary> static void zhuanpiaohongchong() { //对专票备注进行赋值--貌似不能修改--需要确认 var pageName = "开具增值税专用发票"; var bar = WinApi.FindWindow(null, pageName); var list = WinApi.EnumChilWindowsIntptr(bar); List <IntPtr> list2 = new List <IntPtr>(); for (var i = 2; i < list.Count; i++) { list2 = WinApi.FindChildBar((IntPtr)list[i]); if (list2?.Count >= 22) { break; } } var temp = list2.Select(i => (int)i).ToList(); WinApi.SendMessage(list2[6], 0x0C, IntPtr.Zero, "备注信息"); var list3 = WinApi.FindChildBar(list2[19]); var list4 = WinApi.FindChildBar(list2[21]); foreach (IntPtr t in list3) { //银行名称账号 WinApi.SendMessage(t, 12, IntPtr.Zero, $"银行账号9898989"); } foreach (IntPtr t in list4) { //购方地址,电话 var addressTel = $"购方地 址电话"; WinApi.SendMessage(t, 12, IntPtr.Zero, addressTel); } }