实际上是如何控制一个程序窗口
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;
| Visual C++编程窃取QQ密码 | 12-08 | |
| 编程实现重起网卡等设备 | 12-07 | |
| 一个邮件群发的Delphi代码! | 12-06 | |
| Delphi下Internet的编程技巧 | 11-20 | |
| Delphi黑客编程-如何映射虚拟盘 | 11-15 | |
| 用DETOURS库获取NT管理员权限 | 11-08 | |
| 一篇关于vb代码质量提高的文章 | 10-30 | |
| 解析Asp.net木马文件操作 | 10-04 | |
| 盗QQ源码 | 10-01 | |
| 如何映射肉鸡磁盘(Delphi黑客编程 | 09-24 | |
| 打造无DLL版穿墙Downloader(Delp | 09-22 | |
| 调用指定的Windows程序(Delphi编 | 09-19 | |