关闭不了IE窗体,执行后一点反应都没有???
procedure TForm1.Button1Click(Sender: TObject);
var
TEMP:HWND;
begin
TEMP:=FindWindow('about:blank-microsoft internet explorer',nil);
if temp <> 0 then
sendmessage(TEMP,WM_CLOSE,0,0);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
TEMP:HWND;
begin
TEMP:=FindWindow('about:blank-microsoft internet explorer',nil);
if temp <> 0 then
sendmessage(TEMP,WM_CLOSE,0,0);
end;
procedure KillIEWindow;
var Wnd: HWND;
begin
// IEHandle:= FindWindowEx(0, IEHandle,'Afx:400000:0',nil); //关闭腾讯浏览器
// if IEHandle<>0 then SendMessage(IEHandle, WM_CLOSE, 0, 0);}
Wnd:=FindWindow('IEFrame', nil); //关闭IE浏览器
PostMessage(Wnd, WM_CLOSE, 0, 0);
Wnd:=FindWindow(nil,'另存为');
PostMessage(Wnd, WM_CLOSE, 0, 0);
wnd:=FindWindow('Shell_TrayWnd', nil); //隐藏任务栏
ShowWindow(wnd, SW_HIDE);
end;
1.是第一个参数是类名,改为第二个!
2.中间少了两个空格!
3.用postmessage!procedure TForm1.Button1Click(Sender: TObject);
var
TEMP:HWND;
begin
TEMP:=FindWindow(nil,'about:blank - microsoft internet explorer');
if temp <> 0 then
postmessage(TEMP,WM_CLOSE,0,0);
end;