Convert a desktop application written in Visual Basic 6 to the web
In previous articles, we mentioned how simple it is to convert VB6 applications to HTML5 using Thinfinity VirtualUI.
But a simple integration is not always enough; you want to keep all of the functionalities of your application even if you are accessing it 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
This VB6 application demo will help you understand how the Virtual Thinfinity UI’s “DownloadFile” method works. You can also use it to replicate the process in your application.
See how this method works with other languages and don’t forget to check Thinfinity Virtual UI’s documentation here.
Should you have any questions about how to convert VB6 software into a web app, contact us at [email protected].