Baller4lifeII

Hey there,

I would like to know how I can call the default download function of IExplorer.

I implemented a custom download manager using the IDownloadManager interface because I needed to get some specific information about the file being downloaded. However, I don't want to override the whole download process. I just needed to intercept it, get the necessary information and let it carry on with the default process.

Currently IExplorer is calling my IDownloadManager::Download() function everytime use clicks Save in IExplorer. Can anyone show me how to call the default process, or to replicate it Which means, open the save as dialog, download it and show the current progress dialog if necessary.

Thanks a lot!!!



Re: Internet Explorer Web Development How to replicate the default download process of Internet Explorer?

ballimal

Just throw an exception and IE will call the default DownloadUI.

public void Download(IMoniker pmk, IBindCtx pbc, uint dwBindVerb,
int grfBINDF, IntPtr pBindInfo, string pszHeaders,
string pszRedir, uint uiCP)
{
//get the necessary information.
string url;
pmk.GetDisplayName(pbc, null, out url);

//let it carry on with the default process.
throw new Exception();
}





Re: Internet Explorer Web Development How to replicate the default download process of Internet Explorer?

Baller4lifeII

Haha, very original idea. Must admit, I never thought about using exception. I was so curious, I had to give it a try even though I already found a different work around, but it did not work for me. The exception simply dropped the download process and nothing happened.

Anyway, my solution was to edit the registry before calling DoFileDownload api to trigger default behaviour. Thanks for the post, and if you know for sure that your exception method works, then perhaps I did something wrong.





Re: Internet Explorer Web Development How to replicate the default download process of Internet Explorer?

ballimal

The exception method works for me.

I implement a custom download manager by creating a COM and register it with RegAsm then set the "DownloadUI" in "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer" to point to my COM.

How did you implement your custom download manager





Re: Internet Explorer Web Development How to replicate the default download process of Internet Explorer?

Baller4lifeII

Hey,

I do the exact same thing for our installed version. However, when I tried your exception method I ran it through the debugger in VS .Net 2005 instead with IExplorer as the starting process. I'm not sure if that would make a different or not, but when I threw the exception it simply dropped the download. If you are 100% that it should work, I can build an installer and give it a try.

The main goal I am trying to achieve is to retrieve the download link, which I did, and also the saved path which was very tricky. I had to implement a very vigorous work-around to get this, which included opening my own SaveAs dialog and then finding the default one to send info to it and autodispose of it. Can you think of any easier way to achieve this task Perhaps an easier way to hook into IE default saveAs dialog that I didn't know of Thanks.






Re: Internet Explorer Web Development How to replicate the default download process of Internet Explorer?

ballimal

Is this the saved path that you want

"HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer" => "Download Directory"





Re: Internet Explorer Web Development How to replicate the default download process of Internet Explorer?

Baller4lifeII

If only it was that easy! I should have been more clear, the paths i'm looking for are full paths. Which means the full url of the file on the web, and the full path that the file is being saved to in local machine (ie. C:/foo/filename.bar). Which is why I would need to hook the SaveAs dialog to obtain the directory and file name.

The reg key does me no good as it it only gives me the path, plus it's too fragile because it'll get change if another download is started simultaneously and has changed that directory before I check, which gives me inaccurate data. Also that's typically used more as the default directory.






Re: Internet Explorer Web Development How to replicate the default download process of Internet Explorer?

ballimal

When you let the default DownloadUI run, you have no control over it. i.e. when you throw an exception, your code stop running. The default DownloadUI is the UI with 2 main dialog, the progress dialog and the dialog that ask you what do you want to do, Open/Run or Save.

If the INFO you want are the fullpath of the url and where the user save their files to then the solution may be

1st. got the url.
2nd. ask user where to save the files then
3rd. call the default download process (the dialog with the progress bar) with 1st and 2nd as an argument.

but the 3rd is possible only if IE let you do this and doing so won't let your user do the Open/Run.





Re: Internet Explorer Web Development How to replicate the default download process of Internet Explorer?

Xman_Programmer

i have a bad news

what will you do if user uses another download manger

you can't hock all download mangers

_______________

i have a question

i'm a vb programmer & i have just finished adownload user interface but iwant to implement it

i know the ways to implement a com lib to handel the download process but i want to make this lib by vb, is it posible