A
abedon
Unregistered / Unconfirmed
GUEST, unregistred user!
谁能解释一下这两段Dephi代码(作用:打开IE添加收藏和管理收藏夹对话框)的原理,并将其翻译为C++ Builder语言,多谢了!!!
const
CLSID_ShellUIHelper: TGUID = '{64AB4BB7-111E-11D1-8F79-00C04FC2FBE1}';
procedure TForm1.OrganizeFavorites1Click(Sender: TObject);
var
H: HWnd;
p: procedure(Handle: THandle; Path: PChar); stdcall;
begin
H := LoadLibrary(PChar('shdocvw.dll'));
if H <> 0 then
begin
p := GetProcAddress(H, PChar('DoOrganizeFavDlg'));
if Assigned(p) then p(Application.Handle, PChar(Favorites1.Hint));
end;
FreeLibrary(h);
end;
procedure TForm1.AddtoFavorites1Click(Sender: TObject);
var
ShellUIHelper: ISHellUIHelper;
url, title: Olevariant;
begin
Title := EmbeddedWB1.LocationName;
Url := EmbeddedWB1.LocationUrl;
if Url <> '' then
begin
ShellUIHelper := CreateComObject(CLSID_SHELLUIHELPER) as IShellUIHelper;
ShellUIHelper.AddFavorite(url, title);
end;
end;
const
CLSID_ShellUIHelper: TGUID = '{64AB4BB7-111E-11D1-8F79-00C04FC2FBE1}';
procedure TForm1.OrganizeFavorites1Click(Sender: TObject);
var
H: HWnd;
p: procedure(Handle: THandle; Path: PChar); stdcall;
begin
H := LoadLibrary(PChar('shdocvw.dll'));
if H <> 0 then
begin
p := GetProcAddress(H, PChar('DoOrganizeFavDlg'));
if Assigned(p) then p(Application.Handle, PChar(Favorites1.Hint));
end;
FreeLibrary(h);
end;
procedure TForm1.AddtoFavorites1Click(Sender: TObject);
var
ShellUIHelper: ISHellUIHelper;
url, title: Olevariant;
begin
Title := EmbeddedWB1.LocationName;
Url := EmbeddedWB1.LocationUrl;
if Url <> '' then
begin
ShellUIHelper := CreateComObject(CLSID_SHELLUIHELPER) as IShellUIHelper;
ShellUIHelper.AddFavorite(url, title);
end;
end;