黑客风云——风云网络
设为首页 加入收藏 我要投稿 网站地图
您现在的位置: 黑客风云 >> 黑客文章 >> 黑客进阶 >> 黑客编程 >> 文章正文
[推荐]Delphi编写OICQ自动登陆工具
        ★★★★★
Delphi编写OICQ自动登陆工具
文章整理发布:黑客风云 文章来源:www.05112.com 更新时间:2006-12-6

实际上是如何控制一个程序窗口

procedure TForm1.Button1Click(Sender: TObject);

var

  h1,h:hwnd;

  r:trect;

begin

  h1:=shellexecute(handle,'open','g:\oicq\oicq.exe','','',sw_show);

  repeat

    h:=findwindow(nil,'OICQ用户登录');

    sleep(20);

  until h<>0;

  sendmessage(h1,wm_paint,0,0);

  GetWindowRect(h,r);

  SetForegroundWindow(h);

  setcursorpos(r.Left+210,r.Top+145);

  Mouse_Event(MOUSEEVENTF_LEFTDOWN,r.Left+210,r.Top+145,0,0);

  Mouse_Event(MOUSEEVENTF_LEFTUP,r.Left+210,r.Top+145,0,0);

end;

至于密码的问题,必须使用EnumChildWindow(),回调函数代码如下:
 
先判断哪个是否是一个密码框。

function Callback(h:hwnd;param:Lparam):boolean;stdcall;

var

  buf:array[0..255] of char;

begin

  result:=true;

  GetClassName(h,@buf,255);

  if strpas(buf)='Edit' then

  begin

    Enablewindow(h,true);

    sendmessage(h,wm_settext,255,integer(pchar('Password')));

    //    result:=false;

  end;

end;

 

procedure TForm1.Button1Click(Sender: TObject);

var

  h1,h:hwnd;

  r:trect;

begin

  h1:=shellexecute(handle,'open','g:\oicq\oicq.exe','','',sw_show);

  repeat

    h:=findwindow(nil,'OICQ用户登录');

    sleep(50);

  until h<>0;

  sendmessage(h1,wm_paint,0,0);

  GetWindowRect(h,r);

  SetForegroundWindow(h);

  setcursorpos(r.Left+210,r.Top+145);

  Mouse_Event(MOUSEEVENTF_LEFTDOWN,r.Left+210,r.Top+145,0,0);

  Mouse_Event(MOUSEEVENTF_LEFTUP,r.Left+210,r.Top+145,0,0);

  sleep(1000);

  h:=Findwindow(nil,'OICQ 注册向导');

  EnumChildWindows(h,@CallBack,0);

  caption:=SysErrorMessage(getlasterror);

end;

文章录入:cainiaowang    责任编辑:cainiaowang 
【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
VIP 专 区
Copyright @2006 黑客风云 ●业务联系:QQ 联系怪人 联系奇人 Email:给怪人发邮件 给奇人发邮件
ICP备案:冀06009886