DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 27 Jun 2007 16:44:01 -0700,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    Kevin Cochran
          2    Mattias Sjgren
                 3    Kevin Cochran
                        4    Mattias Sjgren
                               5    Kevin Cochran
                               6    Kevin Cochran
                               7    Kevin Cochran
                               8    Mattias Sjgren


IDownloadManager   
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.InterfaceIsIUnknown),
	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
Date:Wed, 27 Jun 2007 16:44:01 -0700   Author:  

Re: IDownloadManager   
Kevin,


>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?


Have you registered the download manager in the Registry?

Also, I believe you have to add the [MarshalAs(UnmanagedType.LPWStr)]
attribute to the pszHeaders and pszRedir parameters.


Mattias

-- 
Mattias Sjgren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Date:Thu, 28 Jun 2007 07:37:17 +0200   Author:  

Re: IDownloadManager   
Hi Mattias,


> 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
Date:Thu, 28 Jun 2007 07:40:01 -0700   Author:  

Re: IDownloadManager   
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 Sjgren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Date:Thu, 28 Jun 2007 19:26:51 +0200   Author:  

Re: IDownloadManager   
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:


> 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.
> 
Date:Thu, 28 Jun 2007 11:42:04 -0700   Author:  

Re: IDownloadManager   
"Mattias Sjögren" wrote:


> 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.
> 
Date:Thu, 28 Jun 2007 13:06:03 -0700   Author:  

Re: IDownloadManager   
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:


> 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.
> 
Date:Thu, 28 Jun 2007 13:08:06 -0700   Author:  

Re: IDownloadManager   

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


Not a clue, sorry. I'd try asking in one of the IE developer
newsgroups.


Mattias

-- 
Mattias Sjgren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Date:Thu, 28 Jun 2007 22:10:14 +0200   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us