Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++DelphiRAD StudioTech Partner

Powerful Serial Communication Component for Delphi and C++ Builder on Windows

ComPort for Windows

Some days ago I wrote about Comport for Firemonkey by WinSoft but even if you are not planning to use FireMonkey we still have a great component for you: Comport for Windows (TComport) by WinSoft. 
Let’s download the trial version from here and install it (don’t forget to close RAD Studio before).

Features of TComport

  • It’s easy to use and very powerful
  • Can communicate with any device connected to the serial port using RS232 protocol
  • It uses multithreading and overlapping for maximum performance
  • Source code included in the registered version
  • It’s part of Communication Protocol Suite
  • Available for Delphi/C++ Builder 5 – 10.4 and Lazarus 2.0.10

Usage

The makers offer a good example of use but as always we will extend it a little and communicate with a GSM phone by reading full information using the phone internal modem.
I will be using a Samsung J3 for our tests and the phone will be connected to the computer by USB cable. After drivers install is finished we will see a modem in devices manager, in my case COM4, this being the serial port I will use to communicate with the phone.

Check out this step-by-step guide on how to download and use the ComPort DLL Library to make your developer life easy and increase your efficiency.

ComPort for Windows


Let’s start the RAD Studio, open the demo project and run it. In order to communicate with the phone, we have to set up communications parameters and open communication.

ComPort for Windows

Let’s add a TSpeedButton which will be used to send commands for reading the phone extended informations.

ComPort for Windows

TComport has AfterOpenand AfterCloseevents, which are very useful in case we want to do something when the port is open or closed. The demo already contains a procedure named UpdateComInfo which enables or disables the buttons according to the Active property of the port. We will add our SpeedButtonPhoneInfo inside this procedure too.

Now on the OnClick event of our SpeedButtonPhoneInfo, we will send to the phone all the commands that are needed to read the full info.

And here is the result:

ComPort for Windows

But we see something strange, we see both commands sent but no answer and then we see answers to both commands, not very neat, so let’s correct this by adding a variable and two functions.

TComport has OnRxCharevent where we will set the HaveAnswer variable to true and in this way, we will know that phone has answered to our command (and before sending any command to the phone we will set the HaveAnswer variable to false).

Now let’s update OnClick event for our SpeedButtonPhoneInfo with the new functions. I changed the Memo font size as the text was too big and set Memo.WordWrap to true, to can see the full phone info.

And here is the new result:

ComPort for Windows

So, if ComPort for Windows is the tool you need just go to WinSoft and and check out the full version!


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

A software developer and a big fan of technology. I have over 20 years of experience in programming. My first programming language was Basic on ZX Spectrum and after that, I discovered Pascal language on some old computers running CP/M and I fell in love with it. Now I’m using mainly Delphi (based on Pascal language) to write my software.

2 Comments

Leave a Reply

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

IN THE ARTICLES