Board index » delphi » Sending data to a serial port ?

Sending data to a serial port ?

Hi,

Can anybody help me out ?
I need to send something (anything - it doesn't matter what) to the serial
port  (COM 2).
It was quite easy in Turbo Pascal for DOS but it seems to be a little
different in DELPHI.

thanx in advance.
pacific.comput...@unicall.be

 

Re:Sending data to a serial port ?


Quote
> I need to send something (anything - it doesn't matter what) to the serial
> port  (COM 2).
> It was quite easy in Turbo Pascal for DOS but it seems to be a little
> different in DELPHI.

That's because windows is different than DOS.  Win95/98/NT treats the
RS232 port like a file.

Use the commands "CreateFile", "ReadFile", "WriteFile", "FlushFileBuffers"
and "CloseFile".

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

Re:Sending data to a serial port ?


On Tue, 27 Oct 1998 13:51:23 +0100, "Pacific Computer Systems"

Quote
<pacific.comput...@unicall.be> wrote:
>It was quite easy in Turbo Pascal for DOS but it seems to be a little
>different in DELPHI.

Actually, serial I/O was much harder in the DOS days.  If you wanted
to receive data, you needed to write an ISR.  Windows does all that
for you.  As someone else pointed out, there Windows treats the serial
ports much like a file.  Also, the serial I/O API is dramatically
different between Win16 and Win32.

Other Threads