DesktopCast is a sample application with a client-server architecture where a client application can connect to a server application and receive a screenshot taken by the server application once or every 5 seconds using app tethering. The server application is a VCL application, and the client application is available both as a VCL application and as a FireMonkey application.
You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
App tethering requires the following components:
- TTetheringManager. You can use this component to discover other applications that are using app tethering, running either on the same device as your application or on other connected devices.
- TTetheringAppProfile. You can use this component to define the actions and data that your application shares with other applications previously paired using the TTetheringManager.
To use app tethering, add these components to your application and link them together:
- Select the TTetheringAppProfile on the Form Designer.
- On the Object Inspector, enter the name of the TTetheringManager component (
TetheringManager1by default) in the Manager property.
The group of projects for DesktopCast provides two client projects (VCL and FireMonkey) and a server project. The projects are designed so that at a given time you have one of the client projects and the server project running and reachable using app tethering.
In the server application you have the following buttons:
- TakeFullScreenShot takes a screenshot and shows the screenshot.
- StartLiveCast starts taking screenshots each 5 seconds and showing them.
- StopLiveCast stops taking screenshots.
In the client application you have the following buttons:
- Connect establishes a connection to the running server application.
When the connection finishes, you can see text at the top of the application, over the control buttons. If the connection failed, the message says “You are not connected”. If the connection is successful, the message says “Working with: – TTetheringAppProfile1”.
- TakeFullScreenShot or TakeShot executes the server action to take a screenshot remotely.
- StartLiveCast or Start Cast executes the server action to start taking screenshots every 5 seconds remotely.
- StopLiveCast or StopCast executes the server action to stop taking screenshots every 5 seconds remotely.
When the server application takes a screenshot, the server application shows the screenshot and shares the screenshot with the client application, that also shows the server screenshot. Check out the full article in the DocWiki about the DesktopCast sample.
The window title of the VCL client application shows also information about the received screenshot (size and date).