Alle IE Instanzen schließen...
Hat jemand eine Idee, wie ich das am besten machen könnte?!
Also am liebsten, wäre es mir so:
Code:
Aber mir fehlt an der einen Stelle noch der richtige Befehl!
procedure TForm1.Button1Click(Sender: TObject);
var ShellWindow: IShellWindows; WB: IWebbrowser2; spDisp: IDispatch; IDoc1: IHTMLDocument2; k: Integer; begin ShellWindow := CoShellWindows.Create; for k := 0 to ShellWindow.Count do begin spDisp := ShellWindow.Item(k); if spDisp = nil then Continue; spDisp.QueryInterface(iWebBrowser2, WB); if WB <> nil then begin WB.Document.QueryInterface(IHTMLDocument2, iDoc1); if iDoc1 <> nil then begin WB := ShellWindow.Item(k) as IWebbrowser2; // ... Hier müsste sowas wie WB.close; oder so rein end; end; end; end; MFG Evian |
Re: Alle IE Instanzen schließen...
Versuch mal: (WB.ParentWindow AS IHTMLWindow2).Close;
|
Re: Alle IE Instanzen schließen...
Zitat:
ich machs jetzt ein wenig umständlich über eine weitere Funktion:
Code:
procedure Tform1.KillProcess(hWindowHandle: HWND);
var hprocessID: INTEGER; processHandle: THandle; DWResult: DWORD; begin SendMessageTimeout(hWindowHandle, WM_CLOSE, 0, 0, SMTO_ABORTIFHUNG or SMTO_NORMAL, 5000, DWResult); if isWindow(hWindowHandle) then begin GetWindowThreadProcessID(hWindowHandle, @hprocessID); if hprocessID <> 0 then begin processHandle := OpenProcess(PROCESS_TERMINATE or PROCESS_QUERY_INFORMATION, False, hprocessID); if processHandle <> 0 then begin TerminateProcess(processHandle, 0); CloseHandle(ProcessHandle); end; end; end; end; |
Re: Alle IE Instanzen schließen...
Die Suche ist Gold wert [dp]fenster schließen[/dp] -> das 6. Ergebnis sollte es sein ;)
...:cat:... |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:40 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz