Create a gist now

Instantly share code, notes, and snippets.

@hamxiaoz /isxdl.cs
Last active Feb 17, 2016

What would you like to do?
How to use [isxdl.dll](http://woohaeng.com.ne.kr/docs/isxdl.htm) to download files in C#?
[DllImport("isxdl.dll")]
static extern Int32 isxdl_Download(IntPtr hWndParent, String pszURL, String pszFileName);
[DllImport("isxdl.dll")]
static extern Int32 isxdl_SetOption(String option, String value);
private void button_download_Click(object sender, EventArgs e)
{
var fileUrl = "REPLACE_ME";
// use dll to download
String downloadFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "COMPANY", "Downloaded Updates");
if (!Directory.Exists(downloadFolder)) Directory.CreateDirectory(downloadFolder);
String downloadedFile = Path.Combine(downloadFolder, Path.GetFileName(fileUrl));
isxdl_SetOption("title", "Downloading Updates");
isxdl_SetOption("label", "Downloading Updates...");
Int32 result = isxdl_Download(IntPtr.Zero, fileUrl, downloadedFile);
if (result == 1)
{
// file downloaded
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment