Article View: borland.public.cppbuilder.nativeapi
Article #12748WriteFile(to COM1)
From: Nicholas Gessler
Date: Thu, 20 Nov 2003 00:17
Date: Thu, 20 Nov 2003 00:17
35 lines
2597 bytes
2597 bytes
I am sorry but I just don't get it. So here I go again... I have written code in Windows98 to talk to COM1 with calls like these: TransmitCommChar(hComm, 'w'); Sleep(1); TransmitCommChar(hComm, '0'); Sleep(1); TransmitCommChar(hComm, '1'); Sleep(1); The entire source code is at: http://www.sscnet.ucla.edu/geog/gessler/borland/ezio-stepper-accelerator.txt It works superbly in Windows98 but like molasses in WindowsXP. On Windows98, 200 sets of calls to hComm take 9 seconds. On WindowsXP, 200 sets of calls to hComm take 81 seconds. On Windows98, these calls modified by Sleep() ranging from 2 to 10 milliseconds take: 1.0, 2.2, 3.2, 3.7, and 4.5 seconds. On WindowsXP, these identical calls modified by Sleep() ranging from 2 to 10 milliseconds take: 13, 12, 13, 13, and 12 seconds. QUESTION ONE: Why does the identical code run slower on XP? Admittedly, I know next to nothing about talking to COM1 from Windows. Newsgroup members no doubt wisely recommended that I use WriteFile() and I have tried to modify my code to do just that with no examples to work from and absolutely NO success. Could someone please provide me with a few simple sample lines of code? All I want to do is write and read 2-3 ASCII bytes at a time. Perhaps I need some handshaking, but maybe I don't even need that. I don't think I need multithreading. Could someone also please point me to a tutorial for "Dummies" on this? All I find on the Web is overkill, pages of code where I only need a few lines. Yes, I'm impressed that someone can write all that, but it's way too much for my needs. Isn't there a simple WriteFile() substitute for one simple line: TransmitCommChar(hComm, 'w'); Sleep(1); ??? Thanks, Nick
Technical Details
Message-ID:
<3fbc160d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,bcf3c83168a0fa3a,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-11-19 17:32:57 PST From: "Nicholas Gessler" <gessler@ucla.edu> Sender: "Nicholas Gessler" <gessler@ucla.edu> Reply-To: "Nicholas Gessler" <gessler@ucla.edu> Subject: WriteFile(to COM1) Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 4.60.102.178 NNTP-Posting-Host: 207.105.83.66 Message-ID: <3fbc160d$1@newsgroups.borland.com> Date: 19 Nov 2003 17:17:01 -0700 X-Trace: newsgroups.borland.com 1069291021 207.105.83.66 (19 Nov 2003 17:17:01 -0700) Lines: 35 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail