捕获它!(100分)

  • 主题发起人 主题发起人 火鸟
  • 开始时间 开始时间

火鸟

Unregistered / Unconfirmed
GUEST, unregistred user!
请问各位高手如何捕获网易聊天室里的EDIT(发言用的)的句柄?<br>一般方法好象无效.
 
不大可能吧??
 
有没有知道?
 
如果你是想要模拟鼠标的点击按钮完全可以用mouse_event 函数
 
哇,你想干什么?
 
你用winsight32看的吗?chat.163.com是ie类的还是定制的?句柄可能没有,但是可以通过<br>接口写/读那写内容的。
 
可不可以先取得当前聊天室的窗口的句柄,然后根据这个句柄取得<br>这个窗口内你需要的WebBrowser,然后分析HTML代码,取得你需要的<br>edit的代码。定时或者用线程去读取。
 
先取得当前聊天室的窗口的句柄,然后用如下代码获取该窗口中的所有输入框:<br>uses SHDocVw,MSHTML;<br>procedure GetIETextField(w:longint):TStringList;<br>var i,k:integer;<br>&nbsp; &nbsp; ShellWindow: IShellWindows;<br>&nbsp; &nbsp; IE:IWebBrowser2;<br>&nbsp; &nbsp; IDoc:IHTMLDocument2;<br>&nbsp; &nbsp; spDisp:IDispatch;<br>&nbsp; &nbsp; aInputText:IHTMLInputTextElement;<br>&nbsp; &nbsp; v:OLEVariant;<br>&nbsp; &nbsp; tmpList:TStringList;<br>begin<br>&nbsp; tmpList:=TStringList.Create;<br>&nbsp; ShellWindow:=CoShellWindows.Create;<br>&nbsp; for k:=0 to ShellWindow.Count-1 do<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; v:=k;<br>&nbsp; &nbsp; &nbsp; spDisp:=ShellWindow.Item(v);<br>&nbsp; &nbsp; &nbsp; spDisp.QueryInterface(IWEBBROWSER2,IE);<br>&nbsp; &nbsp; &nbsp; if IE=nil then continue;<br>&nbsp; &nbsp; &nbsp; if IE.Get_HWND&lt;&gt;w then continue;<br>&nbsp; &nbsp; &nbsp; IDoc:=IE.Document as IHTMLDocument2;<br>&nbsp; &nbsp; &nbsp; if iDoc=nil then continue;<br>&nbsp; &nbsp; &nbsp; if Idoc.Frames.Length&lt;&gt;0 then continue;<br>&nbsp; &nbsp; &nbsp; for i:=0 to Idoc.all.length-1 do<br>&nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if Idoc=nil then Break;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spDisp:=Idoc.all.item(i,varEmpty);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if SUCCEEDED(spDisp.QueryInterface(IHTMLInputTextElement,aInputText)) then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if aInputText.value&lt;&gt;'' then &nbsp;//****//<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tmpList.add('name:'+aInputText.name+' &nbsp;value:'+aInputText.value);<br>&nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; break;<br>&nbsp; &nbsp; end;<br>&nbsp; result:=tmpList;<br>end;<br><br>如果要对特定的输入框,只需要在//****//那行进行判断:<br>if aInputText.name='xxxxxxx' then <br>
 
另外,<br>如果该页面为Frame或者iFrame形式,在上述代码的<br>if idoc.Frames.lenght&lt;&gt;0 then Continue那行再进行处理。
 
接受答案了.
 

Similar threads

回复
0
查看
978
不得闲
D
回复
0
查看
867
DelphiTeacher的专栏
D
D
回复
0
查看
836
DelphiTeacher的专栏
D
D
回复
0
查看
785
DelphiTeacher的专栏
D
S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
后退
顶部