Title: How to Clear Typed URL History
Question: How can i programticly delete the history of typed url's?
Answer:
I was asked by a fellow developer how to clear the url history, Below is the simple answer.
Var
reg:TRegistry;
begin
reg:=TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
reg.OpenKey('Software\Microsoft\Internet Explorer\',False);
reg.DeleteKey('TypedURLs');
reg.CloseKey;
reg.Free;
end;
Simply put this on a buttons onclick property and done :-)
If you want to list the items listed you can do it like this
You will need a button and a memo on your form
Var
reg:TRegistry;
url:Integer; {The number of this url in the history}
URL1:String; {The address it self}
begin
Memo1.Clear {Delete anything already in the memo}
reg:=TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
reg.OpenKey('Software\Microsoft\Internet Explorer\TypedURLS',False);
URL:=1;
While URL1000 Do
{any number here it will jump out of loop when the url retreived is empty/blank}
Begin
URL1:=(reg.ReadString('url'+IntToStr(url)));
If URL1='' Then URL:=1000
{if the retrevied is blank, stop and continue out of loop}
Else
Begin
Memo1.Lines.Add(URL1);
Url:=Url+1;
End;
End;
reg.CloseKey;
reg.Free;
end;
Hope this helps