HighTechTalks DotNet Forums  

IDownloadManager

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss IDownloadManager in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
=?Utf-8?B?S2V2aW4gQ29jaHJhbg==?=
 
Posts: n/a

Default IDownloadManager - 06-27-2007 , 07:44 PM






Greetings,

I am trying to make a custom download manager in c#. The code compile, I
register it with gacutil and regasm, but when I open IE and click on a link
to download, I get the standard IE download dialog. Is there something I'm
missing? I am new to COM, so any help would be appreciated. Here is my
complete code:

/* BEGIN CODE */
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace MyDownloader
{
[ComImport, GuidAttribute("988934A4-064B-11D3-BB80-00104B35E7F9"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceI sIUnknown),
ComVisible(false)]
public interface IDownloadManager
{
void Download(
System.Runtime.InteropServices.ComTypes.IMoniker pmk,
System.Runtime.InteropServices.ComTypes.IBindCtx pbc,
UInt32 dwBindVerb,
Int32 grfBINDF,
IntPtr pBindInfo,
String pszHeaders,
String pszRedir,
UInt32 uiCP
);
}

[ComImport, Guid("988934A4-064B-11D3-BB80-00104B35E7F9")]
public interface Downloader
{
}

[Guid("78BC4A4C-63B7-41CC-B287-858663AF4281"),
ClassInterface(ClassInterfaceType.None)]
public class MainClass : IDownloadManager
{
public MainClass()
{
}

public void Download(
System.Runtime.InteropServices.ComTypes.IMoniker pmk,
System.Runtime.InteropServices.ComTypes.IBindCtx pbc,
UInt32 dwBindVerb,
Int32 grfBINDF,
IntPtr pBindInfo,
String pszHeaders,
String pszRedir,
UInt32 uiCP)
{
MessageBox.Show("Got it!");
}
}
}
/* END CODE */

Thanks,
Kevin


Reply With Quote
  #2  
Old   
=?Utf-8?B?S2V2aW4gQ29jaHJhbg==?=
 
Posts: n/a

Default Re: IDownloadManager - 06-28-2007 , 10:40 AM






Hi Mattias,

Quote:
Have you registered the download manager in the Registry?
I assumed that regasm did this for me. I had also used regsvcs, but it did
not change the results. Is there some other way to register my control?

Thanks,
Kevin


Reply With Quote
  #3  
Old   
=?Utf-8?B?S2V2aW4gQ29jaHJhbg==?=
 
Posts: n/a

Default Re: IDownloadManager - 06-28-2007 , 02:42 PM



Hi Mattias,

Perfect! Thanks for your help. There is still one problem, though, which is
a bit strange. For most downloads, this works. But there is a site which
pushes the file bits via an ADO Stream object. In this scenario, IE does not
use the download manager, but instead uses it's built-in. The content type
varies (application/octet-stream, audio/mp3, video/wmv, etc.), and the file
name is set properly in the content disposition.

Do you have any idea about this? Is there another interface I need to
implement in order to catch all downloads?

Thanks,
Kevin


"Mattias Sjögren" wrote:

Quote:
Kevin,

I assumed that regasm did this for me.

It will only handle normal COM registration (unless you add additional
code in a ComRegisterFunction). Not the special registration
requirements for download managers

http://msdn2.microsoft.com/en-us/library/aa753618.aspx


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Reply With Quote
  #4  
Old   
=?Utf-8?B?S2V2aW4gQ29jaHJhbg==?=
 
Posts: n/a

Default Re: IDownloadManager - 06-28-2007 , 04:06 PM





"Mattias Sjögren" wrote:

Quote:
Kevin,

I assumed that regasm did this for me.

It will only handle normal COM registration (unless you add additional
code in a ComRegisterFunction). Not the special registration
requirements for download managers

http://msdn2.microsoft.com/en-us/library/aa753618.aspx


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Reply With Quote
  #5  
Old   
=?Utf-8?B?S2V2aW4gQ29jaHJhbg==?=
 
Posts: n/a

Default Re: IDownloadManager - 06-28-2007 , 04:08 PM



It looks like a specific problem with the Content-Disposition header, and can
be solved with RegisterBindStatusCallback. Any idea about how I would
implement that?

Thanks,
Kevin

"Mattias Sjögren" wrote:

Quote:
Kevin,

I assumed that regasm did this for me.

It will only handle normal COM registration (unless you add additional
code in a ComRegisterFunction). Not the special registration
requirements for download managers

http://msdn2.microsoft.com/en-us/library/aa753618.aspx


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.