Einzelnen Beitrag anzeigen

HW764
(Gast)

n/a Beiträge
 
#3

Re: Mit Delphi Cookies Löschen

  Alt 25. Jul 2004, 18:15
sry

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, CheckLst,wininet;

type
  TForm1 = class(TForm)
    CheckListBox1: TCheckListBox;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var    
  icei : PINTERNETCACHEENTRYINFO;
  dwSize : DWord;    
  hSearch : DWord;    
begin
  CheckListBox1.Items.BeginUpdate;
  CheckListBox1.Items.Clear;
  dwSize := 65536;    
  icei := AllocMem(dwSize);    
  try    
    hSearch := FindFirstURLCacheEntry('cookie:',icei^,dwSize);    
    if hSearch = 0 then
    begin    
      ShowMessage(SysErrorMessage(GetLastError)+' '+IntToStr(dwSize));    
      exit;    
    end;    
    while hSearch <> 0 do
    begin
      Application.ProcessMessages;
      CheckListBox1.Items.Add(icei^.lpszSourceUrlName);
      dwSize := 65536;    
      if not FindNextURLCacheEntry(hSearch,icei^,dwSize) then
      begin    
        hSearch := 0;    
      end;
    end;    
  finally    
    FreeMem(icei,65536);
    CheckListBox1.Items.EndUpdate;    
  end;
end;


procedure TForm1.Button3Click(Sender: TObject);
var    
  i : integer;    
begin
  for i := 0 to CheckListBox1.Items.Count-1 do    
  begin    
    if CheckListBox1.Checked[i] then
    begin    
      DeleteURLCacheEntry(PChar(CheckListBox1.Items[i]));    
    end;
  end;    
  Button1.Click;
end;


end.
  Mit Zitat antworten Zitat