[3H]关于利用IE自带的函数ImportExportFavorites的正确用法请教……(100分)

  • 主题发起人 主题发起人 3h
  • 开始时间 开始时间
3

3h

Unregistered / Unconfirmed
GUEST, unregistred user!
代码:
uses<br>&nbsp; ... SHDocVw;<br><br>...<br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; a: ^TShellUIHelper;<br>begin<br>a^.[red]ImportExportFavorites[/red](WordBool(true), '');<br>end;
<br><br>运行程序,按按钮就会出错,[:(]很明显这个函数的用法不行。<br>请教正确用法。<br><br>它运行正确的话应该是弹出IE的那个导入导出收藏夹的对话框吧[?]<br>我觉得IE有很多功能是可以利用的,不过不知道用法。[:(]<br><br>很久没来大富翁了,太忙了[:(],100分抛砖引玉[:)]
 
我考,没Create你就用<br><br>var<br>&nbsp; Sh: ISHellUIHelper;<br>begin<br>&nbsp; CoCreateInstance(CLSID_SHELLUIHELPER, nil, CLSCTX_INPROC_SERVER,<br>&nbsp; &nbsp; IID_IShellUIHelper, Sh);<br>&nbsp; sh.ImportExportFavorites(True, '');<br>end;
 
CLSID_SHELLUIHELPER<br>&nbsp; 是在哪里定义的?<br>CoCreateInstance<br>&nbsp; 在AvtiveX单元里定义。但找不到 CLSID_SHELLUIHELPER<br>
 
CLSID是文件标志符 注册表里有例子<br>
 
const<br>&nbsp; ID: TGUID = '{729FE2F8-1EA8-11D1-8F85-00C04FC2FBE1}';<br>&nbsp; //IShellUIHelper<br>var<br>&nbsp; Sh: ISHellUIHelper;<br>begin<br>&nbsp; CoCreateInstance(ID, nil, CLSCTX_SERVER, IID_IShellUIHelper, Sh);<br>&nbsp; sh.ImportExportFavorites(WordBool(True), '');<br>end;<br><br>其实IID_IShellUIHelper也是跟ID的值同一个。<br>返回SH的值是nil,总是出错。<br>诸位有何良策?是不是ID不能用这个值?[:(]
 
你的TGUID不对<br>&nbsp; CLSID_ShellUIHelper: TGUID = '{64AB4BB7-111E-11D1-8F79-00C04FC2FBE1}'
 
成功!<br>------------------------------------------------<br>Uses<br>&nbsp; ...SHDocVw, ActiveX;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>const<br>&nbsp; ID: TGUID = '{64AB4BB7-111E-11D1-8F79-00C04FC2FBE1}';<br>var<br>&nbsp; Sh: ISHellUIHelper;<br>begin<br>&nbsp; CoCreateInstance(ID, nil, CLSCTX_INPROC_SERVER, IID_IShellUIHelper, Sh);<br>&nbsp; sh.ImportExportFavorites(False, '');<br>&nbsp; //如果为True则为导出成HTML,否则是从HTML导入。<br>end;
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
706
import
I
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部