C
cui007
Unregistered / Unconfirmed
GUEST, unregistred user!
大家帮我看看这段代码有什么问题,我写了一个防止广告条出现的程序,可是还是出现广告条
不知道错在哪里?
procedure TForm1.Timer1Timer(Sender: TObject);
var
MainHD,WorkAHD,ViewHD: THandle;
y_workA,y_view: LongInt;
rect1,rect2: TRect;
begin
//kill AD
MainHD:=FindWindowEX(0,0,'CabinetWClass',nil);
if MainHD<>0 then
begin
WorkAHD:=FindWindowEx(MainHD,0,'WorkerA',nil);
GetWindowRect(WorkAHD,rect1);
y_workA:=rect1.Top;
ViewHD:=FindWindowEX(MainHD,0,'Shell do
cObject View',nil);
if ViewHD<>0 then
begin
GetWindowRect(ViewHD,rect2);
y_view:=rect2.Top;
Form1.Caption:=IntToStr(y_workA)+'---'+IntToStr(y_view);
if y_view - y_workA <5 then
PostMessage(MainHD,WM_CLOSE,0,0);
end;
end;
end;
不知道错在哪里?
procedure TForm1.Timer1Timer(Sender: TObject);
var
MainHD,WorkAHD,ViewHD: THandle;
y_workA,y_view: LongInt;
rect1,rect2: TRect;
begin
//kill AD
MainHD:=FindWindowEX(0,0,'CabinetWClass',nil);
if MainHD<>0 then
begin
WorkAHD:=FindWindowEx(MainHD,0,'WorkerA',nil);
GetWindowRect(WorkAHD,rect1);
y_workA:=rect1.Top;
ViewHD:=FindWindowEX(MainHD,0,'Shell do
cObject View',nil);
if ViewHD<>0 then
begin
GetWindowRect(ViewHD,rect2);
y_view:=rect2.Top;
Form1.Caption:=IntToStr(y_workA)+'---'+IntToStr(y_view);
if y_view - y_workA <5 then
PostMessage(MainHD,WM_CLOSE,0,0);
end;
end;
end;