2010. december 5., vasárnap

Closing Internet Explorer from Delphi (Second Way)


Problem/Question/Abstract:

Kill all opened Internet Explorer windows, second way

Answer:

procedure TForm1.Button1Click(Sender: TObject);
// RadikalQ3, www.q3.nu/trucomania
  procedure CierraInternetExplorer;
  var
    Mango: THandle;
  begin
    //Cerramos todas las ventanas del Internet Explorer:
    repeat
      Mango := FindWindow('CabinetWClass', nil);
      if Mango <> 0 then
        SendMessage(Mango, WM_NCDestroy, 0, 0);
    until (Mango = 0);

    repeat
      Mango := FindWindow('IEFrame', nil);
      if Mango <> 0 then
        SendMessage(Mango, WM_NCDestroy, 0, 0);
    until (Mango = 0);
  end;

end;

Nincsenek megjegyzések:

Megjegyzés küldése