usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Runtime.InteropServices;usingSystem.Windows.Forms;namespaceapitest{ Public Partial classForm1:form { PublicForm1 () {InitializeComponent (); } [DllImport ("user32.dll", EntryPoint ="Setcursorpos")] Private Static extern intSetcursorpos (intXinty); [DllImport ("user32.dll", EntryPoint ="mouse_event")] Public Static extern voidMouse_event (intDwFlags,intDX,intDy,intCbuttons,intdwExtraInfo); Const intMouseeventf_move =0x0001;//Mobile Mouse (10): 1 Const intMouseeventf_leftdown =0x0002;//simulate the left mouse button press (10): 2 Const intMouseeventf_leftup =0x0004;//simulate the left mouse button lifted (10): 4 Const intMouseeventf_rightdown =0x0008;//mimic the right mouse button press (10): 8 Const intMouseeventf_rightup =0x0010;//mimic the right mouse button lift (10): Const intMouseeventf_middledown =0x0020;//imitate the middle mouse button press (10): Const intMouseeventf_middleup =0x0040;//mimic middle mouse button lift (10): Const intMouseeventf_absolute =0x8000;//indicate if absolute coordinates are taken (10): 32768 Private voidForm1_Load (Objectsender, EventArgs e) { intIX =710; intIY =510; Sendkeys.sendwait ("HongHu123"); Setcursorpos (IX, IY); Mouse_event (Mouseeventf_leftdown,0,0,0,0); Mouse_event (Mouseeventf_leftup,0,0,0,0); System.Threading.Thread.Sleep ( -);//Set the pause time, otherwise the account and password will be sent in a boxsendkeys.sendwait ("{Tab}");//Send tabSendkeys.sendwait ("PWD123456");//Enter the game passwordSendkeys.sendwait ("{ENTER}");//Input Enter key } }}
View Code
C # API Beginners to develop coordinates to achieve 11 battle platform automatic Login