捐赠 | 广告 | 注册 | 发布 | 上传 | 关于我们    
  沪ICP备05001939号 DELPHI盒子 | 盒子论坛 | 盒子文章 | 盒子问答悬赏 | 最新更新 | 论坛检索 | 下载中心 | 高级搜索    
  精品专区 | 繁體中文 | 奖励公告栏 | 直通车账号登陆 | 关闭GOOGLE广告 | 临时留言    
 
广告
评论:模仿spy4win中的IE 网页分析功能
djunny 38729 2009/9/29 11:06:44
感谢~以前我也研究过这个,
GetIEFromHWND(iehandle,iewebbrowser);
每一个IE的主框架的确是有句柄查询到iewebbrowser接口的,
但是,大家是否考虑过在IFRAME里再获取子元素?
在页面里有一个IFRAME或者FRAME的,子窗口就没有句柄了,
这个时候能否有方法递归获取到子框架里去?获得子框架的IHTMLDOCUMENT接口和鼠标的相关坐标?
huhuc 38634 2009/9/16 15:43:59
SendMessage无法再次SendMessage吗?咋一看,窗口过程没有返回,肯定是没法处理下一条消息.我差一点就把它作为结论记到笔记里了,但总觉得有点不对,
因此实验了下,结论是即使是对同一窗口过程,也是可以再次SendMessage的,也是说窗口过程是可重入的,如下
procedure wm_user3(var msg:TMsg); message wm_user+3;
procedure wm_user4(var msg:TMsg); message wm_user+4;
……
procedure TForm1.wm_user3(var msg:TMsg);
var
  pt:Tpoint;
  x,y:integer;
  threadid:Cardinal;
  s:array[0..255] of char;
  h:THandle;
begin
  GetCursorPos(pt);
  h:=WindowFromPoint(pt);
  x:=pt.X;
  y:=pt.Y;
  self.caption:='x='+inttostr(x)+' y='+inttostr(y)+'  handle='+inttostr(h);
  FillChar(s,255,0);
  GetClassName(h,s,255);
  edt_winClass.Text:=StrPas(@s[0]);
  edt_formhandle.Text:=IntToStr(h);
  GetWindowRect(h,rect);
  edt_rect.Text:='left:'+inttostr(rect.Left)+',right:'+inttostr(rect.Right)+',width:'+inttostr(rect.Right-rect.Left)+',height:'+inttostr(rect.Bottom-rect.top);
  if (lstrcmp(s,'Internet Explorer_Server')=0) then
  begin
    Sleep(10);
    if iehandle<>h then
    begin
      iehandle:=h;
      GetIEFromHWND(iehandle,iewebbrowser);
    end;
    form1.edt_url.Text:=(iewebbrowser.LocationURL);
    Document:=iewebbrowser.Document as IHtmlDocument2;
    form1.edt_ihtmldcoument2.Text:=IntToStr(Integer(Pointer(document)));
    if Assigned(Document) then
    begin
      Form1.edt_formtext.Text:=Document.title;
      elem:=document.elementFromPoint(x-rect.Left,y-rect.Top);
      form1.edt_tagname.Text:=elem.tagName;
      Form1.edt_elemID.Text:=elem.id;
      form1.edt_elemtext.Text:=elem.innerText;
      form1.mmo1.Text:=elem.outerHTML;
    end;
    if tmr1.Enabled=False then
      tmr1.Enabled:=true;
  end
  else
    clear;
end;
procedure TForm1.tmr1Timer(Sender:TObject);
begin
  SendMessage(Handle,wm_user+4,0,0);
end;
procedure TForm1.wm_user4(var msg:TMsg);
begin
  SendMessage(Handle,wm_user+3,0,0);
end;
zslm 38616 2009/9/12 23:52:53
你也可以用这个代替hook,hook的作用就是取得类名及光标位置

var

  Point:TPoint;
s:array[0..255]of Char;
  Hwnd:Cardinal;

 

  GetCursorPos(Point); 
 Hwnd:=WindowFromPoint(Point);
  GetClassName(Hwnd,s,256);
jimjim 38614 2009/9/12 15:41:14
好东西,感谢lz,就是钩子有一点问题,编译出来小红伞报毒,怎么办?
第一页 上一页 下一页 最后页 有 4 条纪录 共1页 1 - 4
 用户名:
 密 码:
自动登陆(30天有效)
 
  DELPHI盒子版权所有 1999-2023 V4.01 粤ICP备10103342号-1 更新RSS列表