Download DLL

About

IS Download DLL is a "plugin" for Inno Setup that allows you to download files from the Internet during the installation process.

Primarily written to be used from Inno Setup, but can be used by any software that can call DLL's. If you have the declarations needed for VB or other languages, please send them to me to include them on this page.

Exported Functions

Definitions for Inno Setup Pascal Scripting

function isxdl_Download(hWnd: Integer; URL, Filename: String): Integer;
external 'isxdl_Download@files:isxdl.dll stdcall';

procedure isxdl_AddFile(URL, Filename: String);
external 'isxdl_AddFile@files:isxdl.dll stdcall';

procedure isxdl_AddFileSize(URL, Filename: String; Size: Cardinal);
external 'isxdl_AddFileSize@files:isxdl.dll stdcall';

function isxdl_DownloadFiles(hWnd: Integer): Integer;
external 'isxdl_DownloadFiles@files:isxdl.dll stdcall';

procedure isxdl_ClearFiles;
external 'isxdl_ClearFiles@files:isxdl.dll stdcall';

function isxdl_IsConnected: Integer;
external 'isxdl_IsConnected@files:isxdl.dll stdcall';

function isxdl_SetOption(Option, Value: String): Integer;
external 'isxdl_SetOption@files:isxdl.dll stdcall';

function isxdl_GetFileName(URL: String): String;
external 'isxdl_GetFileName@files:isxdl.dll stdcall';
		

Definitions for Visual Basic

Public Declare Function isxdl_Download Lib "isxdl.dll" _
(ByVal ihWnd As Integer, ByVal strURL As String, ByVal strFilename As String) As Integer

Public Declare Function isxdl_AddFile Lib "isxdl.dll" _
(ByVal strURL As String, ByVal strFilename As String) As Integer

Public Declare Function isxdl_AddFileSize Lib "isxdl.dll" _
(ByVal strURL As String, ByVal strFilename As String, ByVal lngSize As Long) As Integer

Public Declare Function isxdl_DownloadFiles Lib "isxdl.dll" _
(ByVal ihWnd As Integer) As Integer

Public Declare Sub isxdl_ClearFiles Lib "isxdl.dll" ()

Public Declare Function isxdl_IsConnected Lib "isxdl.dll" () As Integer

Public Declare Function isxdl_SetOption Lib "isxdl.dll" _
(ByVal strOption As String, ByVal strValue As String) As Integer

Public Declare Function isxdl_GetFileName Lib "isxdl.dll" _
(ByVal strRL As String) As String
		

Definitions for C++

extern "C" {
	int isxdl_Download(HWND hWndParent, LPCWSTR pszURL, LPCWSTR pszFileName);
	void isxdl_AddFile(LPCWSTR pszURL, LPCWSTR pszFileName);
	void isxdl_AddFileSize(LPCWSTR pszURL, LPCWSTR pszFileName, DWORD dwSize);
	int isxdl_DownloadFiles(HWND hWndParent);
	void isxdl_ClearFiles(void);
	int isxdl_IsConnected(void);
	int isxdl_SetOption(LPCWSTR pszOption, LPCWSTR pszValue);
	LPCWSTR isxdl_GetFileName(LPCWSTR pszURL);
};

isxdl_Download

Immediately downloads a file from the Internet.

Syntax

int isxdl_Download(
	HWND	hWndParent,
	LPCWSTR	pszURL,
	LPCWSTR	pszFileName
);

Parameters

    hWndParent
    Handle to parent window.
    pszURL
    The URL to be downloaded.
    pszFileName
    The name of the file on the local machine.

Return Value

Returns 1 if all files where downloaded successfully, otherwise 0.

isxdl_AddFile

Adds a file to the internal file list.

Syntax

void isxdl_AddFile(
	LPCWSTR	pszURL,
	LPCWSTR	pszFileName
);

Parameters

    pszURL
    The URL to be downloaded.
    pszFileName
    The name of the file on the local machine.

Return Value

Returns nothing.

Remarks

To access a url with basic password protection, enter something like http://username:password@www.domain.com/path/page.html as url.

isxdl_AddFileSize

Adds a file to the internal file list, and tells how big the file is. Use this if you know the size of the file, and know that it will not change. Means that the DLL won't have to find the size, which can take some time if you have many files to download.

Syntax

void isxdl_AddFileSize(
	LPCWSTR	pszURL,
	LPCWSTR	pszFileName,
	DWORD	dwSize
);		

Parameters

    pszURL
    The URL to be downloaded.
    pszFileName
    The name of the file on the local machine.
    dwSize
    The size of the file.

Return Value

Returns nothing.

isxdl_DownloadFiles

Downloads all files added with isxdl_AddFile or isxdl_AddFileSize.

Syntax

int isxdl_DownloadFiles(
	HWND	hWndParent
);

Parameters

    hWndParent
    Handle to the parent window.

Return Value

Returns 1 if all files where downloaded successfully, otherwise 0.

isxdl_ClearFiles

Clears the internal file list. Shouldn't be necessary since files will be removed as they are successfully downloaded.

Syntax

void isxdl_ClearFiles();

Return Value

Returns nothing.

isxdl_IsConnected

Tells wether the computer is connected to the Internet or not. This is kind of experimental, and very little tested.

Syntax

int isxdl_IsConnected();

Return Value

Returns 1 if connected to the Internet, otherwise it returns 0.

isxdl_SetOption

Set various options.

Syntax

int isxdl_SetOption(
	LPCWSTR	pszOption,
	LPCWSTR	pszValue
);

Parameters

    pszOption
    The option to be modified.
    pszValue
    The value of the option. Note that this must always be given as a string.

Return Value

Returns 1 if the option was set successfully. Returns 0 if the option was unknown, or the option could not be set.

Remarks

Currently these options can be set:
OptionValue
titleThe title to use for the download window.
debugNot used. Valid values are "true" and "false".
simpleTurns on simple mode if the value is a string, turns off simple mode if the value is an empty string.
labelText for header label.
descriptionText for header description.
languageLanguage file to get texts from.
resumeTell it to use resume. Default is true. (Disabled.)
smallwizardimageThe image to display if you want something other than the default.

isxdl_GetFileName

Get the real file name of a downloaded file. The URL to download ISTool is 'http://www.istool.org/getistool.aspx', and before downloading isxdl_GetFileName returns 'getistool.aspx'. After downloading, the result will be 'istool-5.0.6.1.exe'.

Syntax

LPCWSTR GetFileName(
	LPCWSTR pszURL
);

Parameters

    pszURL
    The URL to get the file name for.

Return Value

Returns the file name if the URL was found, otherwise returns NULL.