Return-Path: Received: (qmail 21765 invoked from network); 11 Apr 2001 13:27:23 -0000 Received: from unknown (HELO murphys-inbound.servers.plus.net) (212.159.14.225) by excalibur.plus.net with SMTP; 11 Apr 2001 13:27:23 -0000 Received: (qmail 27920 invoked from network); 11 Apr 2001 13:27:19 -0000 Received: from unknown (HELO post.thorcom.com) (212.172.148.70) by murphys with SMTP; 11 Apr 2001 13:27:19 -0000 Received: from majordom by post.thorcom.com with local (Exim 3.16 #2) id 14nKXq-0000We-00 for rsgb_lf_group-outgoing@blacksheep.org; Wed, 11 Apr 2001 14:20:26 +0100 X-Priority: 3 X-MSMail-Priority: Normal Received: from d06lmsgate-3.uk.ibm.com ([195.212.29.3]) by post.thorcom.com with esmtp (Exim 3.16 #2) id 14nKXd-0000W0-00 for rsgb_lf_group@blacksheep.org; Wed, 11 Apr 2001 14:20:13 +0100 Received: from d06relay02.portsmouth.uk.ibm.com (d06relay02.portsmouth.uk.ibm.com [9.166.84.148]) by d06lmsgate-3.uk.ibm.com (1.0.0) with ESMTP id OAA154036 for ; Wed, 11 Apr 2001 14:10:13 +0100 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Received: from usa.net (ss6.bld.socks.ibm.com [9.14.4.71]) by d06relay02.portsmouth.uk.ibm.com (8.8.8m3/NCO v4.95) with ESMTP id OAA135654 for ; Wed, 11 Apr 2001 14:19:01 +0100 Message-ID: <3AD45975.D92DAF2E@usa.net> Date: Wed, 11 Apr 2001 15:17:41 +0200 From: "Alberto di Bene" Organization: Undisclosed X-Mailer: Mozilla 4.76 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 To: rsgb_lf_group@blacksheep.org Subject: Re: LF: VERY TECHNICAL: Comports and Delphi References: <28743670.986928810075.JavaMail.imail@chilly.excite.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk Reply-To: rsgb_lf_group@blacksheep.org X-Listname: rsgb_lf_group Sender: john sexton wrote: > Hi fellow programmers, > Sorry to use the reflector for this purpose, but I know there are a lot of > Delphi programmers out there. > Can anyone tell me how to read from the COM1 port using Delphi and 32-bit > Windows? It has got to be simple, but I just can't find it amongst the > mountain of information. Regrettably C++ answers won't help. > Many thanks in advance, > John, G4CNN > Hi John, my suggestion is language-independent. Check the Windows APIs CreateFile, GetCommModemStatus and ReadFileEx. Using CreateFile you specify COM1 as file name and get in return a handle. Then you call GetCommModemStatus with this handle, and you have in return the status of CTS, DTR, etc. if this is what you want to do. If instead you want to read the actual data present on COM1, you use the ReadFileEx, again using the handle returned by the CreateFile. Using Windows API will guarantee you (within limits...) that your program will survive a Windows version upgrade. 73 Alberto I2PHD