Drag and drop files into your VB6 virtualized application
We keep receiving comments and questions from VB6 developers about the features that Thinfinity VirtualUI has to enable desktop applications to interact with users worldwide without client setups of any kind. We want to thank you all for that. With your questions, we’ll continue to publish articles that help to engage the users and to improve their experience.
Today we welcome the “Drag and drop” event, which is a very commonly used feature in any modern desktop application and in web applications as well. Many times, this event is combined with the Thinfinity VirtualUI’s upload method. Will see that too.
Since you will publish your VB6 desktop application on the web, you have to take into account that the end-user will interact with it through a web browser, so if you coded the classic “Drag and Drop” event on your VB6 application, the user will get the file rendered by the browser doing what he is used to doing.
In the following example, we’ll learn how to adapt a VB6 application. We’ll get the same application that you can download from this link.
What to do:
1. Download Thinfinity VirtualUI from here.
2. Install it and start your trial.
3. Open your VB6 project ante declare the following first:
This way we declare that VirtualUI will use its events. Besides, we will assign the end-user file’s source folder to the “Filename” variable.
4. Instantiate a VirtualUI object and make it call its start method.
5. Implement the VirtualUI’s “onDragFile” event.
This event will receive a file from the user’s machine and needs to realize somehow that the file is being dropped. Note that “Action” is for “Thinfinity.DragAction”. As you can see, we code that in the second line (“If Action = Drop Then”) to trigger what’s about to happen in the third and the fourth line.
When the file is dropped, the third line will make the app show the server machine’s path in the box where the file is being uploaded. Then the VirtualUI’s upload method will do the rest, passing as a parameter the “Filename” which is the user machine’s source for the file being uploaded.