ie设置的问题(100分)

  • 主题发起人 主题发起人 coolbaby
  • 开始时间 开始时间
C

coolbaby

Unregistered / Unconfirmed
GUEST, unregistred user!
1。 大家知道,通过修改注册表可以在ie的工具栏上添加新的按钮,但是好象要手动的在工具栏
上的自定义里再添加一下才能生效,不知道如何让它,不用再手工设置,就可以生效
2。 能否用程序清空ie的历史记录。

 
ie的历史记录有一部分存放在注册表里,把那些键值全删光就可以了,
 
1、可以可以 要不要给你个例子啊 :)
2、同上
 
1.第一个问题请看贴
http://www.delphibbs.com/delphibbs/dispq.asp?lid=189391
2.
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Activex, Comobj, StdCtrls, ComCtrls, Grids;

const

STATURL_QUERYFLAG_ISCACHED = $00010000;
STATURL_QUERYFLAG_NOURL = $00020000;
STATURL_QUERYFLAG_NOTITLE = $00040000;
STATURL_QUERYFLAG_TOPLEVEL = $00080000;

STATURLFLAG_ISCACHED = $00000001;
STATURLFLAG_ISTOPLEVEL = $00000002;


IID_IEnumStatUrl: TGUID = (D1: $3C374A42; D2: $BAE4; D3: $11CF; D4: ($BF, $7D, $00, $AA, $00, $69, $46, $EE));
IID_IUrlHistoryStg: TGUID = (D1: $3C374A41; D2: $BAE4; D3: $11CF; D4: ($BF, $7D, $00, $AA, $00, $69, $46, $EE));
IID_IUrlHistoryStg2: TGUID = (D1: $AFA0DC11; D2: $C313; D3: $831A; D4: ($83, $1A, $00, $C0, $4F, $D5, $AE, $38));
IID_IUrlHistoryNotify: TGUID = (D1: $BC40BEC1; D2: $C493; D3: $11D0; D4: ($83, $1B, $00, $C0, $4F, $D5, $AE, $38));

SID_IEnumStatUrl = '{3C374A42-BAE4-11CF-BF7D-00AA006946EE}';
SID_IUrlHistoryStg = '{3C374A41-BAE4-11CF-BF7D-00AA006946EE}';
SID_IUrlHistoryStg2 = '{AFA0DC11-C313-11d0-831A-00C04FD5AE38}';
SID_IURLHistoryNotify = '{BC40BEC1-C493-11d0-831B-00C04FD5AE38}';
CLSID_CUrlHistory: TGUID = '{3C374A40-BAE4-11CF-BF7D-00AA006946EE}';


type
STATURL = record
cbSize: DWORD;
pwcsUrl: DWORD;
pwcsTitle: DWORD;
ftLastVisited: FILETIME;
ftLastUpdated: FILETIME;
ftExpires: FILETIME;
dwFlags: DWORD;
end;


IEnumSTATURL = interface(IUnknown)
['{3C374A42-BAE4-11CF-BF7D-00AA006946EE}']
function Next(celt: Integer; out elt; pceltFetched: PLongint): HRESULT; stdcall;
function Skip(celt: Longint): HRESULT; stdcall;
function Reset: HResult; stdcall;
function Clone(out ppenum: IEnumSTATURL): HResult; stdcall;
function SetFilter(poszFilter: PWideChar; dwFlags: DWORD): HResult; stdcall;
end;

IUrlHistoryStg = interface(IUnknown)
['{3C374A41-BAE4-11CF-BF7D-00AA006946EE}']
function AddUrl(pocsUrl: PWideChar; pocsTitle: PWideChar; dwFlags: Integer): HResult; stdcall;
function DeleteUrl(pocsUrl: PWideChar; dwFlags: Integer): HResult; stdcall;
function QueryUrl(pocsUrl: PWideChar; dwFlags: Integer; var lpSTATURL: STATURL): HResult; stdcall;
function BindToObject(pocsUrl: PWideChar; var riid: TIID; out ppvOut: Pointer): HResult; stdcall;
function EnumUrls(out ppenum: IEnumSTATURL): HResult; stdcall;
end;

IUrlHistoryStg2 = interface(IUrlHistoryStg)
['{AFA0DC11-C313-11D0-831A-00C04FD5AE38}']
function AddUrlAndNotify(pocsUrl: PWideChar; pocsTitle: PWideChar; dwFlags: Integer;
fWriteHistory: Integer; var poctNotify: Pointer;
const punkISFolder: IUnknown): HResult; stdcall;
function ClearHistory: HResult; stdcall;
end;

IUrlHistoryNotify = interface(IOleCommandTarget)
['{BC40BEC1-C493-11d0-831B-00C04FD5AE38}']
end;



TForm1 = class(TForm)
StringGrid1: TStringGrid;
RetrieveBtn: TButton;
ClearBtn: TButton;
procedure RetrieveBtnClick(Sender: TObject);
procedure ClearBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
I: IUrlHistoryStg2;

implementation

{$R *.DFM}


function FileTimeToDt(Ft: TFileTime): TDateTime;
var
l: Integer;
lft: TFileTime;
begin
FileTimeToLocalFiletime(Ft, lft);
if FileTimeToDosDateTime(lft, Longrec(l).Hi, Longrec(l).Lo) then
result := FiledateToDatetime(l) else
result := 0;
end;


procedure TForm1.RetrieveBtnClick(Sender: TObject);//得到历史记录
var
r: Staturl;
Enum: IEnumStatUrl;
X: Integer;
Row: Integer;
begin
StringGrid1.Cells[0, 0] := 'Last Visited';
StringGrid1.Cells[1, 0] := 'Title';
StringGrid1.Cells[2, 0] := 'Url';
StringGrid1.Cells[3, 0] := 'Last Updated';
StringGrid1.Cells[4, 0] := 'Expires';
Row := 0;
I := CreateComObject(ClsId_CUrlHistory) as IUrlHistoryStg2;
I.EnumUrls(Enum);
Enum.SetFilter('http://', 0);
while enum.next(1, r, @X) = S_OK do begin
Inc(Row);
StringGrid1.RowCount := Row + 1;
Stringgrid1.Cells[0, Row] := DateTimeToStr(FileTimeToDt(r.ftLastVisited));
Stringgrid1.Cells[1, Row] := PWidechar(Pointer(r.pwcsTitle));
Stringgrid1.Cells[2, Row] := PWidechar(Pointer(r.pwcsUrl));
Stringgrid1.Cells[3, Row] := DateTimeToStr(FileTimeToDt(r.ftLastUpdated));
Stringgrid1.Cells[4, Row] := DateTimeToStr(FileTimeToDt(r.ftExpires));
end;
end;

procedure TForm1.ClearBtnClick(Sender: TObject);//这儿清空历史记录
begin
I.ClearHistory;
end;

end.
够了吧?这100分值得,呵呵...
 
关键是第一个问题!
我不管手动或是用程序把这些键值加进去以后
好象都必须到工具栏的“自定义”在添加一次
才会出现?
 
If Not RegC.KeyExists('SOFTWARE/MICROSOFT/INTERNET EXPLORER/EXTENSIONS/{0713E8D2-850A-101B-AFC0-4210102A8DA7}') Then
Begin
RegC.openkey('SOFTWARE/MICROSOFT/INTERNET EXPLORER/EXTENSIONS/{0713E8D2-850A-101B-AFC0-4210102A8DA7}',true);
RegC.writestring('ButtonText',****************);
RegC.writestring('MenuText',**************);
RegC.writestring('CLSID','{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}');
RegC.writestring('Default Visible','Yes');
RegC.writestring('Exec',Application.ExeName);
RegC.writestring('Icon',*******);

顺便,哪位装VC的朋友帮我生成个 CLSID ,在此先谢过了。datm@21cn.com
 
Delphi里面的Ctrl+Shift+G生成的GUID是不是要求的?
 
我再说清楚一些,必须是用程序修改完注册表,就可以直接在
工具栏上出现。不用再手工添加一步
 
对不起,我发现我的错误了
以前是因为工具栏上的按钮太多了

这次,重做了一次系统,出来了
原来我原来的程序就没毛病
哈哈

马上收衣服
 
to zhangkan,
thanks ,你的程序清除历史记录很好使,但是列的好象不全呀
 
多人接受答案了。
 
惭愧呀,我没有作出什么共享,混分来了[:D][8D]
 
后退
顶部