关闭错误弹出窗口,我是用Timer来做的:
h := findwindow(nil,'Internet Explorer 脚本错误');
if H > 0 then
begin
sendmessage(H,WM_CLOSE,0,0);
end;
findwindow(nil,'Internet Explorer 脚本错误'),必须写全'Internet Explorer 脚本错误',不对的话就行不通,那么关闭另外的IE窗口是不是也要写全呢?应该怎样做?写‘Microsoft Internet Explorer’也不行,请高手指点。
h := findwindow(nil,'Internet Explorer 脚本错误');
if H > 0 then
begin
sendmessage(H,WM_CLOSE,0,0);
end;
findwindow(nil,'Internet Explorer 脚本错误'),必须写全'Internet Explorer 脚本错误',不对的话就行不通,那么关闭另外的IE窗口是不是也要写全呢?应该怎样做?写‘Microsoft Internet Explorer’也不行,请高手指点。
SysUtils, Windows, Messages;function EnumWindowsProc(hWnd: HWND; lParam: LParam): Longbool; stdcall;
var
Buf: array[0..1023] of Char;
begin
Result:=true;
FillChar(Buf, SizeOf(Buf), 0);
GetWindowText(hWnd, @Buf, SizeOf(Buf));
if Pos('Internet Explorer', Buf)>0 then
begin
SendMessage(hWnd, WM_CLOSE, 0, 0);
Result:=false;
end;
end;begin
EnumWindows(@EnumWindowsProc, 0);
ReadLn;
end.
SysUtils, Windows, Messages;function EnumWindowsProc(hWnd: HWND; lParam: LParam): Longbool; stdcall;
var
Buf: array[0..1023] of Char;
begin
Result:=true;
FillChar(Buf, SizeOf(Buf), 0);
GetWindowText(hWnd, @Buf, SizeOf(Buf));
WriteLn(Buf); //加上这一句看看<==============================================
if Pos('Internet Explorer', Buf)>0 then
begin
SendMessage(hWnd, WM_CLOSE, 0, 0);
Result:=false;
end;
end;begin
EnumWindows(@EnumWindowsProc, 0);
ReadLn;
end.