Last active
February 17, 2016 23:34
-
-
Save hamxiaoz/36729bfea4a37301c0e5 to your computer and use it in GitHub Desktop.
How to use [isxdl.dll](http://woohaeng.com.ne.kr/docs/isxdl.htm) to download files in C#?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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