当前位置:首页 > 游戏信息 > 正文

求写个c语言的小程序,一键登陆魔兽世界的

求写个c语言的小程序,一键登陆魔兽世界的-第1张-游戏信息-龙启网

java ,c#,或者vb吧。c还是算了。。。

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Diagnostics;

using System.Runtime.InteropServices;

namespace WowLoader1

{

class Program

{

[DllImport("user32.dll")]

public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

const int WM_KEYDOWN = 0x100;

const int WM_KEYUP = 0x101;

const int WM_CHAR = 0x102;

static string path = @"游戏路径";

static string name = "你的账号";

static string password = "你的密码";

public static void SendString(IntPtr handle, string str)

{

foreach (char c in str)

{

SendMessage(handle, WM_KEYDOWN, c, 0);

SendMessage(handle, WM_CHAR, c, 0);

SendMessage(handle, WM_KEYUP, c, 0);

}

}

static void Main(string[] args)

{

Process pro = Process.Start(path);

pro.WaitForInputIdle(-1);

System.Threading.Thread.Sleep(1000);

SendString(pro.MainWindowHandle,name);

SendString(pro.MainWindowHandle, "\t");

SendString(pro.MainWindowHandle, password);

SendString(pro.MainWindowHandle, "\r");

}

}

}