MJInternetAutomation: Difference between revisions

From wiki.jriver.com
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
Line 32: Line 32:
Example:
Example:
MJIA.DownloadMode = DOWNLOADMODE_NO_UI DOWNLOADMODE_BLOCKING;
MJIA.DownloadMode = DOWNLOADMODE_NO_UI DOWNLOADMODE_BLOCKING;

[[Category:COM Automation]]

Latest revision as of 05:40, 4 May 2015

interface for helping in downloading files from internet

Functions

string DownloadToString(string URL)

Description: Downloads web page from the specified URL to a string. (should not be used with binary data, only web pages)
Parameters:

  • URL: The URL from which the web page will be downloaded

Return Value: a string containing the contents of the web page.

number DownloadToFile(string URL, string FileName)

Description: Downloads data from a resource identified by a URL to a local file.
Parameters:

  • URL: The URL from which the data will be downloaded.
  • FileName: The name of the local file to receive the data.

Return Value: True if the function completed successfully, otherwise FALSE.

string DownloadToTempFile(string URL)

Description: Downloads data from a resource identified by a URL to a local temp file.
Parameters:

  • URL: The URL from which the data will be downloaded.

Return Value: Returns the full path to the temp file.

void Cancel()

Description: Cancels previously called download function. Can be used only when DownloadMode set to DOWNLOADMODE_NO_UI or DOWNLOADMODE_NO_UI_BLOCKING.

Properties

MJInetDownloadModes DownloadMode (read / write)

Description: Gets or sets download mode.

  • DOWNLOAD_MODE_DEFAULT - displays UI while downloading files from the Internet
  • DOWNLOADMODE_NO_UI - does not display UI but processes the message loop so the Cancel function can be called from the same thread.
  • DOWNLOADMODE_BLOCKING - will lock the app until the download is finished.
  • DOWNLOAD_MODE_NO_AUTHENTICATION - disables authentication.

Example:

MJIA.DownloadMode = DOWNLOADMODE_NO_UI DOWNLOADMODE_BLOCKING;