找QQ句柄的问题(100分)

  • 主题发起人 主题发起人 aipingren
  • 开始时间 开始时间
A

aipingren

Unregistered / Unconfirmed
GUEST, unregistred user!
QQ2003,请问怎么找到QQ的登陆框的里的那个输入QQ号码的EDIT的句柄!(不是注册向导,就是开始运行时出现的直接登陆的那个窗口),我就想问怎么得到那个QQ号码输入框的句柄!怎么找也找不到!除了用鼠标获取外,有没有通过父窗口来寻找此句柄的方法啊?谢谢!<br>
 
你用Microsoft Visual Studio里面的SPY++来看,你就能很好发现,其中我这里的是窗口类名为“#32770 (Dialog)”,窗口标题就是一些#13和空格组成的字符,然后找到登陆窗口,再找他的子窗口,我这里是第4个子窗口。
 
procedure TForm1.Button1Click(Sender: TObject);<br>var<br>myhandle:Thandle;<br>text:array[0..128] of char;<br>begin<br>myhandle:=findwindowex(findwindow('#32770',nil),0,'combobox',nil);<br>sendmessage(myhandle,wm_gettext,128,integer(@text));<br>showmessage(text);<br>end;<br>
 
得不到那个密码框里的密码的<br>
 
unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs, StdCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; hQQlog,hQQlogPSW,hCurWindow,hLogBtn,hNoBtn,hRgBtn:HWND;<br>&nbsp; QQpsw:array[0..128] of char;<br>&nbsp; nType:longint;<br>begin<br>&nbsp; while hCurWindow&gt;0 do<br>&nbsp; begin<br>&nbsp; &nbsp; &nbsp; hCurWindow := FindWindow('#32770',nil); //找所有这个类的窗口,根据三个特征按钮<br>&nbsp; &nbsp; &nbsp; hLogBtn:= FindWindowEx(hCurWindow,0,'Button','登录');//来判断是不是QQlog dlg<br>&nbsp; &nbsp; &nbsp; hNoBtn := FindWindowEx(hCurWindow,0,'Button','取消');<br>&nbsp; &nbsp; &nbsp; hRgBtn := FindWindowEx(hCurWindow,0,'Button','注册向导');<br>&nbsp; &nbsp; &nbsp; if ((hLogBtn&gt;0) and (hNoBtn&gt;0) and (hRgBtn&gt;0)) then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; hQQlog:=hCurWindow;<br>&nbsp; &nbsp; &nbsp; &nbsp; hQQlogPSW:=findwindowex(hQQlog,0,'edit',nil);<br>&nbsp; &nbsp; &nbsp; &nbsp; nType:=sendmessage(hQQlogPSW,EM_GETPASSWORDCHAR,0,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; PostMessage(hQQlogPSW,EM_SETPASSWORDCHAR,0,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; Sleep (100);<br>&nbsp; &nbsp; &nbsp; &nbsp; SendMessage(hQQlogPSW,WM_GETTEXT,255,integer(@QQpsw));<br>&nbsp; &nbsp; &nbsp; &nbsp; showmessage(qqpsw);<br>&nbsp; &nbsp; &nbsp; &nbsp; PostMessage (hQQlogPSW,EM_SETPASSWORDCHAR,nType,0);<br>&nbsp; &nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; hCurWindow :=GetWindow(hCurWindow,GW_HWNDNEXT);<br>&nbsp; end;<br>end;<br><br>end.<br><br><br>OK,拿分
 
http://www.delphibbs.com/keylife/iblog_show.asp?xid=4270
 
后退
顶部