This function retrieves a file from the HTTP or HTTPS server.

[C++Builder/Visual C++]     BOOL IKHTTPGetFileEx(HINTERNET hConnect, LPCTSTR RemoteFile, LPCTSTR LocalFile, long TransPercent, IKPROCESSPROC UserProc);
[Delphi]         function IKHTTPGetFileEx(hConnect: HINTERNET; RemoteFile, LocalFile: LPCTSTR; TransPercent: Longint; UserProc: LONG_PTR): LongBool;
[Visual Basic]   Function IKHTTPGetFileEx(ByVal hConnect As Long, ByVal RemoteFile As String, ByVal LocalFile As String, ByVal TransPercent As Long, ByVal UserProc As Long) As Long

Parameters

Name Explanation
hConnect The session handle retrieved from the IKHTTPConnect function
RemoteFile The name and path of the file to be retrieved
LocalFile The filename and path on the local computer where the file will be saved
TransPercent The percent of file tranferred before the User Function is called
UserProc The address of the user function (If not using the user function then set to 0)

Return Value

Returns True (nonzero) if successful. Returns False (0) if unsuccessful.

Explanation

The IKHTTPGetFile function retrieves a file from the HTTP or the HTTPS server. It can be used only after the IKHTTPConnect function has successfully connected to the HTTP(S) server. This method can only be executed from the client computer. It does not operate on the server. The TransPercent parameter sets the percent of file tranferred before the User Function is called.

Example Code:

(1) C++Builder/Visual C++
HINTERNET hOpen, hConnect;
if (IKHTTPConnect("www.newtone.co.jp", "User", "Password", &hOpen, &hConnect) == FALSE) return;
IKHTTPGetFileEx(hConnect, "images/001.jpg", "C:\\Images\\001.jpg", 10, 0);
IKHTTPDisconnect(hOpen, hConnect);

(2) Delphi
hOpen, hConnect: HINTERNET;
if (IKHTTPConnect('www.newtone.co.jp', 'User', 'Password', @hOpen, @hConnect) = False) then Exit;
IKHTTPGetFileEx(hConnect, 'images/001.jpg', 'C:\Images\001.jpg', 10, 0);
IKHTTPDisconnect(hOpen, hConnect);

(3) Visual Basic
Dim hOpen As Long
Dim hConnect As Long
If IKHTTPConnect("www.newtone.co.jp", "User", "Password", hOpen, hConnect) = False Then Exit Sub
Call IKHTTPGetFileEx(hConnect, "images/001.jpg", 'C:\Images\001.jpg', 10, 0)
Call IKHTTPDisconnect(hOpen, hConnect)

 

The ImageKit10 ActiveX is a product created by Newtone Corporation