How to take your VB6 application to the web

How to take your VB6 application to the web

While some discuss if Microsoft Visual Basic 6.0 is still active, we agree with Tim Anderson’s opinion (click here to read the full article): “VB will stick around for a while. It is still the macro language of Microsoft Office – and yes, this is essentially the VB 6.0 variant, still included in Office 365, though it is called Visual Basic for Applications.”

The present blog post is all about taking your old apps to the cloud. Those legacy apps are useful and robust and users love them. But these same users are now migrating to web environments. Can you put a VB6 Application on the web? Yes, you can!

We will show you how to adapt your VB6 application so you can publish your app to the web with Thinfinity® VirtualUI.


1. First, we will see how to start the app in the development environment using ‘DemoVB6’.
To run the app you have to create VirtualUI object like this:

Private Sub Form_Load()
Set VUI = CreateObject(“VirtualUI.VirtualUI”)
VUI.DevMode = True
VUI.DevServer.Port = 6080
VUI.DevServer.Enabled = True
VUI.Start (60)


End Sub


 Bear in mind you might need to register VirtualUI’s library. In order to do so, open command prompt as administrator and call VirtualUI’s dlls with the command ‘regsvr32’ like this:

C:\Program Files\Thinfinity\VirtualUI\bin64>regsvr32 Thinfinity.VirtualUI.dll
C:\Program Files\Thinfinity\VirtualUI\dev\bin64>regsvr32 Thinfinity.VirtualUI.dll


2. After you run the application you should see that VirtualUI’s development server will show on your system tray:

 

 3. Now you should be able to see the app running in the desktop and in the browser.


 4.Left-Click it and hit ‘Open Web Browser’.

To publish your app in the “prod” server manager you just have to comment the following lines:
VUI.DevMode = True
VUI.DevServer.Port = 6080
VUI.DevServer.Enabled = True

Like this:

 5. Now you can build the .exe of the app and add it to VirtualUI’s server manager.




On occasion, 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, 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.

  1. 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.

It’s use
First, we’ll make the following declaration In General – Declarations



This way, we can instantiate the VUI object next.




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.



 This is how the DownloadFile method firm should be coded:

DownloadFile c:\path\filename.ext, newname.ext, application/binary

Free demo:
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.

If you have any further inquiries or need additional support, please do not hesitate to reach out to us. Our team is always available to help address any questions or concerns you may have.


    • Related Articles

    • How to take your PowerBuilder application to the web

      Adopt Thinfinity VirtualUI, and migrate your PowerBuilder application to the web without rewriting the whole code. In this quick tutorial, we’ll learn how to integrate a PowerBuilder application with the Thinfinity VirtualUI Libraries to run your ...
    • How to take your Delphi application to the web

      Take your software written in Delphi to web, in minutes! In this article, we will show you how to adapt your Delphi application, Windows-based, so you can run it in the cloud (as if it was 100% HTML5) with Thinfinity VirtualUI. If you’re new to ...
    • Run VB.Net software as a Web Application

      In this new article, we will show you how to adapt your Visual FoxPro code so you can run VB.Net developments in the cloud with Thinfinity VirtualUI. App example: https://www.cybelesoft.com/support/files/DemosVUI/VBNet.zip Bear in mind in this ...
    • How to Publish an Application in Thinfinity VirtualUI Server

      Product: Thinfinity VirtualUI Version: 3 and above Introduction This step-by-step tutorial will guide you through the process of virtualizing your applications and making them accessible from any web browser using Thinfinity VirtualUI. Get ready to ...
    • How to take your WinDev Application to the Web

      Did you know that you can integrate any WinDev application with Thinfinity VirtualUI, and publish it on the Web or Cloud in no time? If you are a WinDev developer or inherit a WinDev application, you don’t have to migrate your project to a new ...