RAD Studio 10.4.1 is now available! Learn more. Looking for discounts? Visit our Special Offers page!
C++Delphi

Quickly And Easily Mirror Device Screens With DesktopCast Delphi Sample App

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:

To use app tethering, add these components to your application and link them together:

  1. Select the TTetheringAppProfile on the Form Designer.
  2. On the Object Inspector, enter the name of the TTetheringManager component (TetheringManager1 by 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).

Check out the full source code for the DesktopCast projects for Delphi and C++Builder over on GitHub.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

FMXExpress.com has over 600 articles with all kinds of tips and tricks for Delphi FireMonkey on Android, IOS, OSX, Windows, and Linux.
Related posts
DelphiShowcase

Powerful Petroleum And Mining Software For Surface And Subsurface Data Visualization Is Built In Delphi

C++CodeDelphiIDE

Quickly Log Python Script Output To The Delphi Debug Log In Your Windows Apps

CodeDelphiRAD Studio

Learn How To Use Connection Pooling With A Multi-threaded Environment In Delphi

CodeDelphi

Learn How To Build A REST API App For iOS In 45 Minutes With Delphi

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES