DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: zlyscuicui
今日帖子: 16
在线用户: 4
导航: 论坛 -> 文档资料 斑竹:liumazi,ruralboy  
作者:
男 goodsuperstar (superstar) ★☆☆☆☆ -
盒子活跃会员
2003/9/27 21:28:44
标题:
让你的程序自动关闭弹出广告窗口 浏览:4387
加入我的收藏
楼主: 首先添加一个Timer控件,创建一个过程
private
    { Private declarations }
     procedure KillChildWindows(hand: HWND);
代码如下:
procedure TForm1.KillChildWindows(hand: HWND);
var
  h: HWND;
  s: Array[0..255] of char;
  IsPopWindow: Bool;
begin
  IsPopWindow:=True;
  h:=GetWindow(hand,GW_child);
  while h>0 do
  begin
    GetClassName(h, s, 256);
    if (StrPas(s)='WorkerA') or (StrPas(s)='WorkerW') then
    If IsWindowVisible(h) then
      IsPopWindow:=False;
    h:=GetWindow(h,GW_HWNDNEXT);
  end;
  if IsPopWindow then
    PostMessage(hand,WM_CLOSE,0,0);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  h: HWnd;
  Text: array [0..255] of char;
begin
  h:=GetWindow(Handle, GW_HWNDFIRST);
  while h <> 0 do
  begin
    if GetWindowText(h, @Text, 255)>0 then
    if GetClassName(h, @Text, 255)>0 then
    if (StrPas(Text)='CabinetWClass') or (StrPas(Text)='IEFrame') then
      KillChildWindows(h);
    h:=GetWindow(h, GW_HWNDNEXT);
  end;
end;

试试看~~广告是不是少多了?你可以让程序在后台执行,就看你怎么发挥了,呵呵~~
不过不能监视 myie浏览器,它会不停的试图将它关闭-_-~~
----------------------------------------------
幼儿园的时候我不谈恋爱,因为不知道什么是贼
小学的时候我不谈恋爱,因为知道没有贼心也没有贼胆
初中的时候我不谈恋爱,因为有贼胆没贼心
高中的时候我不谈恋爱,因为有贼心没贼胆
大学的时候我不谈恋爱,因为有了贼心,也有了贼胆,贼却没了
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行66.40625毫秒 RSS