But a simple integration is not always enough; you want to keep all of the functionalities of your application even if you are accessing through the browser from a remote computer.
Once you have your VB6 application ready to be published on the web, as shown in this article, you may allow users to download files to any remote machine.
The “ThinfinityVirtualUI.DownloadFile” method for VB6 works in a unique way regarding its overload.
DownloadFile([in] BSTR LocalFilename, [in] BSTR RemoteFilename, [in] BSTR MimeType);
[in] BSTR LocalFilename: Name of the local file to be sent.
[in] BSTR RemoteFilename: Name of the file in the remote machine.
[in] BSTR MimeType: content-type of the file. If specified, the content will be handled by the browser. Leave blank to force download.
First, we’ll make the following declaration In General – Declarations
This way, we can instantiate the VUI object next.
NOTE: We enabled standard dialogs to let the user select the file from the host in “VUI.StdDialogs = True”. StdDialogs is set “False” by default.
Let’s now create a button to call the “DownloadFile” method in our VB6 application:
This is what we code to open a dialog and let the user get the file. In this case, we will allow the user to select the path in his machine and the file type in case he needs to change it since we passed the second and third parameters both blank.
NOTE: This is how the DownloadFile method firm should be coded:
DownloadFile c:\path\filename.ext, newname.ext, application/binary