QQ2013自动登陆实现原理


 QQ2013整个登陆界面采用一个子窗口,没有所谓的Edit控件等,界面元素估计都是画上去的,同时底层截取按键消息,保证密码的安全输入安全

因此要实现自动登录最好采用模拟鼠标,键盘等操作方式,mouse_event, keybd_event
 借助spyxx分析QQ界面消息基本都是WM_PAINT.等等。。。


等下来研究获取好友列表与自动加好友



大致实现如下:
HWND pQQWnd = NULL;
pQQWnd = FindWindow(NULL, TEXT("QQ"));

//定位QQ登录框焦点
::SetForegroundWindow(pQQWnd);
 ::SetFocus(pQQWnd);
 RECT qqWRect, qqRect;
 DWORD x, y;
 GetWindowRect(pQQWnd, &qqWRect);
 GetClientRect(pQQWnd, &qqRect);
 
 x = qqWRect.left + qqRect.right / 2;
 y = qqWRect.top + 225;
 
int screenwidth_real=GetSystemMetrics(SM_CXSCREEN);
 int screenheight_real=GetSystemMetrics(SM_CYSCREEN);
 
 mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, (x - 10) * 65536 / screenwidth_real , y * 65536 / screenheight_real, 0, 0);
 Sleep(200);
 mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, x * 65536 / screenwidth_real , y * 65536 / screenheight_real, 0, 0);
 Sleep(1000);
 mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
 Sleep(200);
 mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
 mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
 Sleep(1000);
   keybd_event(VK_BACK, 0, 0, 0);
   keybd_event(VK_BACK, 0, KEYEVENTF_KEYUP, 0);
   Sleep(100);


//输入号码


  PostMessage(pQQWnd, WM_CHAR, (TCHAR)'3', 0);
  Sleep(100);
  PostMessage(pQQWnd, WM_CHAR, (TCHAR)'0', 0);
  Sleep(100);
  PostMessage(pQQWnd, WM_CHAR, (TCHAR)'2', 0);
  Sleep(100);
  PostMessage(pQQWnd, WM_CHAR, (TCHAR)'9', 0);
  Sleep(100);
  PostMessage(pQQWnd, WM_CHAR, (TCHAR)'5', 0);
  Sleep(100);
  PostMessage(pQQWnd, WM_CHAR, (TCHAR)'3', 0);
  Sleep(100);
  PostMessage(pQQWnd, WM_CHAR, (TCHAR)'7', 0);
  Sleep(100);

//密码输入
   lParam = MAKELPARAM(244, 260);
  SendMessage(pQQWnd, WM_LBUTTONDOWN, MK_LBUTTON, lParam);
  Sleep(1000);
  SendMessage(pQQWnd, WM_LBUTTONUP, MK_LBUTTON, lParam);
  keybd_event(VK_SHIFT, 0, 0, 0);
  keybd_event(56, 0, 0, 0); //密码
  keybd_event(56, 0, KEYEVENTF_KEYUP, 0);
  keybd_event(VK_SHIFT, 0, KEYEVENTF_KEYUP, 0);
  Sleep(100);
  keybd_event(56, 0, 0, 0);//密码。。。
  keybd_event(56, 0, KEYEVENTF_KEYUP, 0);
  Sleep(100);
。。。。。。。。。。。。

//登录按钮单击
  lParam = MAKELPARAM(216, 340);
  SendMessage(pQQWnd, WM_LBUTTONDOWN, 0, lParam);
  SendMessage(pQQWnd, WM_LBUTTONUP, 0, lParam); 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值