How can I trans_data in COM1,COM2,using delphi 5.0?

Posted on 2001-06-18
Last Modified: 2010-04-04
How can I trans_data in COM1,COM2,using delphi 5.0?
can you send me some examples or some free control?
Question by:johngodzbi

Expert Comment

ID: 6205376
Hi John,

I use the Varain Async32.. Its a good free ware component

Best Regards


Expert Comment

ID: 6205536
take a look here you will find varain async and many others

Expert Comment

ID: 6208227
Hope this helps...

> I need to send something (anything - it doesn't matter what) to the serial
> port  (COM 2).
> Help tells that we can use standard CreateFile('COM2',...) function to
> communicate with port but I dont believe it - I tried and got nothing

You can make it work with a little more effort.  Here are some more clues:

    fUnit: DWORD;             { Unit descriptor handle}
    fUnitDescriptor: string;    { Unit descriptor Pascal string }

fUnitDescriptor := 'COM2';

procedure TRs232.OpenPort(descriptor: PChar);
  fUnit := CreateFile(descriptor, GENERIC_READ or GENERIC_WRITE,

function TRs232.GetOpenPortError: BOOLEAN;
  Error: DWORD;

  isOK:=(fUnit <> INVALID_HANDLE_VALUE);  //DWORD(-1)
   if not isOK then
     Error := GetLastError;
     {case fUnit of}
     case Error of
       IE_BADID:  ShowMessage('"' + fUnitDescriptor + '" invalid or unsupported');
       IE_BAUDRATE:  ShowMessage('"' + fUnitDescriptor + '" baudrate unsupported');
       IE_BYTESIZE:  ShowMessage('Specified bytesize is invalid');
       IE_DEFAULT: ShowMessage('Default parameters are in error');
       IE_HARDWARE: ShowMessage('"' + fUnitDescriptor + '" not available');
       IE_MEMORY: ShowMessage('"' + fUnitDescriptor + '" - unable to allocate queues');
       IE_NOPEN:  ShowMessage('"' + fUnitDescriptor + '" is not open');
       IE_OPEN: ShowMessage('"' + fUnitDescriptor + '" is already open');
         {ShowMessage('Note: "' + fUnitDescriptor + '" returned error ' +
          IntToStr(Error)); }

function TRs232.Output(lpBuffer: PChar): BOOLEAN;
  lpBytesSent,nBufferSize: LongWord;

  nBufferSize := StrLen(lpBuffer);
  Result := WriteFile(fUnit,        //handle to file to write to
                      lpBuffer,     // pointer to data to write to file
                      nBufferSize,  // number of bytes to write
                      lpBytesSent,  // pointer to number of bytes written
                      nil);  // pointer to structure needed for overlapped IO


function TRs232.Enter(nBytesToRead: LongWord; lpString: PChar; var
lpBytesRead: LongWord): BOOLEAN;


  Result := ReadFile(fUnit,

destructor TRs232.Destroy;
  if not CloseHandle(fUnit) then
    ShowMessage('Error closing port "' + fUnitDescriptor + '"');
  inherited Destroy;

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.


Expert Comment

ID: 6976084
You have asked many questions and only graded 4 of them, and they were all  C and D grades, hard to understand.  ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if they are still open in 14 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.

To view your locked questions, please click the following link(s) and evaluate the proposed answer.

*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
POINTS FOR EXPERTS awaiting comments are listed in the link below
Moderators will finalize this question if in @14 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
Thanks everyone.
Moderator @ Experts Exchange
LVL 26

Expert Comment

by:Russell Libby
ID: 8684227

This Q fell under my range of questions to clean up. The last post (by you) was over a year ago, so how should I handle this? Or can you close this out?


EE Cleanup Volunteer

Accepted Solution

PashaMod earned 0 total points
ID: 8812238
PAQ'ed and points not refunded

Community Support Moderator @Experts Exchange

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now