请问在IDownloadManager的Download事件里如何获取要下载的文件?

waterbao 2011-10-07 01:39:26
请问在IDownloadManager的Download事件里如何获取要下载的文件名?所有参数如下
Download(IMoniker *pmk,
IBindCtx *pbc,
DWORD dwBindVerb,
LONG grfBINDF,
BINDINFO *pBindInfo,
LPCOLESTR pszHeaders,
LPCOLESTR pszRedir,
UINT uiCP)

通过IMoniker 这个接口可以获取下载的URL,但是我要获取要下载的文件名称不知道如何获取?我在SINA或者163的邮箱里,下载附件的时候,名称不知道如何获取?
...全文
342 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
yjgx007 2011-10-17
  • 打赏
  • 举报
回复
http://www.codeproject.com/KB/atl/vbmhwb.aspx
蒋晟 2011-10-10
  • 打赏
  • 举报
回复
RegisterBindStatusCallback
waterbao 2011-10-09
  • 打赏
  • 举报
回复
请问楼上你说的这个获取头的方法是在哪获取,我在OnbeforeNavigate里叶没获取到呀
skyxie 2011-10-08
  • 打赏
  • 举报
回复
这种情况,文件名在 GET这个URL的时候,返回的header中

Content-Type:image/jpg
Content-Disposition:attachment; filename="uQtpTse.jpg"
waterbao 2011-10-08
  • 打赏
  • 举报
回复
正常情况下URL后面是文件名,但是在SINA或者163邮箱里,下载附件的时候,URL是很长的字符串,也根本没有文件名,这个URL就是通过GetDispalyName接口函数获取的,蒋昇大哥我就是用的这个接口,你可以在SINA、163邮件下载附件的时候看一下
ljn398431 2011-10-08
  • 打赏
  • 举报
回复
学习下
蒋晟 2011-10-08
  • 打赏
  • 举报
回复
LPOLESTR pwszUrl = NULL;
pmk->GetDisplayName (pbc, NULL, &pwszUrl);
oyljerry 2011-10-07
  • 打赏
  • 举报
回复
有了URL,最后面不就是文件名?
源代码推荐——VB实现IE下载管理器扩展 ------ 摘要 这个例子演示了如何实现一个自定义IE下载管理器,当IE下载一个文件,VBWebDownloader.exe就会启动来下载它。 (这个项目支持断点续传,而且代码相对简单) 注意:一些第三方的IE下载扩展可能会和这个例子程序冲突,所以在尝试这个例子之前最好临时屏蔽它们。 安装/卸载 A. 安装 对于32bit系统,或者32bit IE运行在54bit系统,安装 VBIEDownloadManagerSetup(x86) 项目输出的VBIEDownloadManagerSetup(x86).msi。对于 64bit IE安装 VBIEDownloadManagerSetup(x64) 项目输出的 VBIEDownloadManagerSetup(x64).msi。 B. 卸载 运行安装时候所用的那个安装程序,并且选择卸载。 演示:(不翻译了,自己看吧) Step1. Open this project in VS2010 and set the platform of the solution to x86. Make sure that the projects VBIEDownloadManagerSetup, VBWebDownloader and VBIEDownloadManagerSetup(x86) are selected to build in Configuration Manager. NOTE: If you want to run this sample in 64bit IE, set the platform to x64 and select VBIEDownloadManagerSetup, VBWebDownloader and VBIEDownloadManagerSetup(x64) to build. Step2. 生成解决方案 Step3. Right click the project VBIEDownloadManagerSetup(x86) in Solution Explorer, and choose "Install". Step4. Open 32bit IE and visit the the download link of Microsoft .NET Framework 4 http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=0a391abd-25c1-4fc0-919f-b21f31ab88b7. Click the "Download" button on this page, and then VBWebDownloader.exe will be launched. In VBWebDownloader.exe, you will find that the url is http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe and the local path is D:\dotNetFx40_Full_x86_x64.exe Step5. Click the button "Download" in VBWebDownloader.exe, it will start to download the file, and after a few minutes, you will find a file D:\dotNetFx40_Full_x86_x64.exe in Windows Explorer. 下载: http://code.msdn.microsoft.com/VBIEDownloadManager-3287b087

3,055

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC HTML/XML
社区管理员
  • HTML/XML社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧