I am trying to implement my custom download manager in IE 6. However, I can't seem to get IE to recognize the DownloadUI registry value I entered. I have a setup project in my solution that registers my assembly with vsdraCOM and I took the CLSID from the assembly information screen in my project properties (the COM interop project is seperate from the rest of the application). I have 'Make Assembly COM-visible' and 'Register for COM Interop' checked under the project properties.
This is the CLSID I'm entering in the registry: 3d79d0a7-6549-46a7-b415-0d1fcd12242a
Here is my IDownloadManager code:
namespace jbtComHdl
{
[
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,System.
UInt32 dwBindVerb,System.
Int32 grfBINDF,System.
IntPtr pBindInfo,[
MarshalAs(UnmanagedType.LPWStr)]System.
String pszHeaders,[
MarshalAs(UnmanagedType.LPWStr)]System.
String pszRedir,System.
UInt32 uiCP);
}
/// <summary> ///The class must have a Guid attribute. /// </summary>[
ComImport, Guid("988934A4-064B-11D3-BB80-00104B35E7F9")] public class COMcoclass{
}
class Handler : IDownloadManager
{
//open new dl screen public void Download (System.Runtime.InteropServices.ComTypes.IMoniker pmk,System.Runtime.InteropServices.ComTypes.
IBindCtx pbc,System.
UInt32 dwBindVerb,System.
Int32 grfBINDF,System.
IntPtr pBindInfo,[
MarshalAs(UnmanagedType.LPWStr)]System.
String pszHeaders,[
MarshalAs(UnmanagedType.LPWStr)]System.
String pszRedir,System.
UInt32 uiCP){
System.Windows.Forms.
MessageBox.Show("Test");DownloadMGR.
NetLib myNetLib = new DownloadMGR.NetLib();DownloadMGR.
DLType typeofDL = myNetLib.GetDLType(pmk.ToString()); string un = ""; string pw = ""; if (typeofDL == DownloadMGR.DLType.FTP){
throw new Exception("oops");}
long _filesize = myNetLib.GetFileSize(pmk.ToString(), typeofDL, un, pw); if (_filesize == 0){
throw new Exception("File not found.");}
System.Windows.Forms.
FolderBrowserDialog fb = new System.Windows.Forms.FolderBrowserDialog();System.Windows.Forms.
DialogResult SaveFileTo = fb.ShowDialog(); //get file info string filesize = _filesize.ToString();DownloadMGR.
DLInfo thisDL = new DownloadMGR.DLInfo(filesize, myNetLib.GetFileName(pmk.ToString()), pmk.ToString(), new Uri(pmk.ToString()).AbsolutePath, un, pw, System.IO.Path.GetFullPath(SaveFileTo.ToString()), "0", typeofDL); string ID = thisDL.SaveDownload(true, "");thisDL.SaveDownload(
true, "");DownloadMGR.
Form1 f1 = new DownloadMGR.Form1();f1.Activate();
f1.Show();
f1.StartDownload(ID);
}
}
}