Article View: borland.public.cppbuilder.nativeapi
Article #3387Re: Comm Port kicking my butt
From: Minas
Date: Sun, 18 Jun 2006 18:09
Date: Sun, 18 Jun 2006 18:09
39 lines
2166 bytes
2166 bytes
Hi JD ,
"JD" <nospam@nospam.com> wrote in message
news:44944ca9$1@newsgroups.borland.com...
> I have absolutely no clue why I can't get this simple test to
> work. All it does is open a port, and write to it and read from
> it.
>
> The write seems to work because no errors are reported and the
> number of bytes written are correct. The read, OTOH reports
> nada - no errors and no data.
> //--------------------------------------------------------------
> void __fastcall TForm1::Button1Click(TObject *Sender)
> {
> if( hCom != INVALID_HANDLE_VALUE )
> {
> DWORD nBytes;
> AnsiString c = "Test String";
> if( ! ::WriteFile( hCom, c.c_str(), c.Length(), &nBytes, NULL) )
> {
> throw ComException( "Write Failed " +
> SysErrorMessage(::GetLastError()), ::GetLastError() );
> }
> ShowMessage("Write " + IntToStr(nBytes) );
> }
> }
> //--------------------------------------------------------------
Can your device understand the command "Test String" ?
If is a modem device better use "at\r" to be sure of Read operation.
_minas
------
"Only virtue's conquests have certainty" Sofokleous Erephyle
Technical Details
Message-ID:
<449596c8@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<44944ca9$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5117e51131b9ac21 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Minas" <(min_charATyahooPUTADOTgr)(HellenicFire)> Newsgroups: borland.public.cppbuilder.nativeapi References: <44944ca9$1@newsgroups.borland.com> Subject: Re: Comm Port kicking my butt Date: Sun, 18 Jun 2006 21:09:09 +0300 Lines: 41 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 193.92.197.158 Message-ID: <449596c8@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1150654152 193.92.197.158 (18 Jun 2006 11:09:12 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail