using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
/*
* If result is 0 then download was successful
* Regards, Rastajan
*/
namespace Download
{
class Download
{
[DllImport("urlmon.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern Int32 URLDownloadToFile(
[MarshalAs(UnmanagedType.IUnknown)] object pCaller,
[MarshalAs(UnmanagedType.LPWStr)] string szURL,
[MarshalAs(UnmanagedType.LPWStr)] string szFileName,
Int32 dwReserved,
IntPtr lpfnCB);
public static int WinAPIDownload(string URL, string Destination)
{
return URLDownloadToFile(null, URL, Destination, 0, IntPtr.Zero);
}
}
}
Gruß, Rastajan.