1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

ScreenThief - stealing screen shots over the Network
Page 1: Network ScreenThief, the idea.
 Win prizes by sharing code!
Do you have some Delphi code you want to share? Are you interested in winning a prize for your work?
Delphi Programming Quickies Contest
 More of this Feature
• Page 2: Server and Client: basic settings
• Page 3: Server and Client: querying and retrieving Client screen shot images

 Join the Discussion
"Post your views, comments, questions and doubts to this article."
 Related Resources
• Exchanging Data over the Network using Delphi - simple CHAT application
• Introduction to INDY
• Network programming with Delphi
• Indy related articles

Hmm, I don't know how to begin ... what you are about to see/explore/learn is so great that I just cannot find the correct words to start with ;)

I've already been writing about "Exchanging Data over the Network using Delphi" - the article served as an introduction to problems and solutions to sending data over the network using Delphi and Indy.

This is what we are up against in this article:
A free network screen shot grabber application, with source code. Let's see how to send / receive raw (binary) data (screen shot images) using TCP connections. To the point: ScreenThief is a network application designed to "steal" screen shot images from client computers and display them in one central location (server application).

Screen thief!
ScreenThief is a standard client-server TCP network application (hm, not one, but two). As with any "socket-aware" project, we have two applications: one acting as a server and another as a client. When using Delphi, Indy componentes let you create applications that can communicate (read from and write to) with other systems using TCP/IP and related protocols.

Note: to be able to understand all the key concepts behind programming with Indy and Delphi, I do suggest you to take a look at several articles listed under Indy knowledge base that explain TCP, (blocking) socket programming, IP's, hosts, ports, etc... You'll not be able to write (or "read") any meaningful network-enabled code until you grasp all the information you can get. I'm not saying that you have to be a TCP guru to start using Indy components - it is just important to understand topics like IP, port, TCP and similar.

First, let's see ScreenThief in action:

ScreenThief in action

What you see above, is the ScreenThief Server application at run time. The "Connected clients" lists all the clients connected to the ScreenThief server application. The "Client details" displays data related to the selected client. The right portion of the screen shows the screen shot image taken from the computer running ScreenThief Client application.

To the old drawing board (Delphi code)...
Ok, you've seen the picture of ScreenThief in action. We'll now go for the code, before we proceed let's see what ScreenThief is made of.

In general, when coding TCP/IP client-server application, the main idea is to have the Server wait for commands from the Client and then do something upon receiving the command. "Unfortunately", in our situation the Server part has to tell the Client to send its screen shot. This means that we need a way of forcing a Client to send a command to the Server - if you have ever coded a TCP network application using sockets you know that this tends to be tricky.

Enough theory, let's create the ScreenThief...

Next page > ScreenThief Server and Client: basic settings > Page 1, 2, 3

©2017 About.com. All rights reserved.