public static void BoardChooseSuccess() { var bar = WinApi.FindWindow(null, "增值税发票税控开票软件(金税盘版) V2.2.34.190427"); WinApi.ShowWindow(bar, 2); Thread.Sleep(100); WinApi.ShowWindow(bar, 3); //bool flag = WinApi.SetForegroundWindow(bar); int fpglHw = WinApi.getHwByTitle((int)bar, "发票管理"); int fpglHw1 = (int)WinApi.FindWindowEx((IntPtr)fpglHw, IntPtr.Zero, null, null); int fpglHw2 = (int)WinApi.FindWindowEx((IntPtr)fpglHw1, IntPtr.Zero, null, null); int fpglHw3 = (int)WinApi.FindWindowEx((IntPtr)fpglHw1, (IntPtr)fpglHw2, null, null); WinApi.SetForegroundWindow(bar); Thread.Sleep(100); //点击发票填开 WinApi.leftClick(fpglHw3); Thread.Sleep(500); keybd_event(Keys.Down, 0, 0, 0); keybd_event(Keys.Down, 0, 2, 0); for (var i = 0; i < 10; i++) { Thread.Sleep(500); keybd_event(Keys.Down, 0, 0, 0); keybd_event(Keys.Down, 0, 2, 0); Thread.Sleep(500); keybd_event(Keys.Down, 0, 0, 0); keybd_event(Keys.Down, 0, 2, 0); Thread.Sleep(500); keybd_event(Keys.Up, 0, 0, 0); keybd_event(Keys.Up, 0, 2, 0); Thread.Sleep(500); keybd_event(Keys.Up, 0, 0, 0); keybd_event(Keys.Up, 0, 2, 0); Thread.Sleep(500); } }