📄 cserialport v1_27.mht
字号:
From: <由 Windows Internet Explorer 7 保存>
Subject: CSerialPort v1.27
Date: Sun, 28 Dec 2008 00:51:07 +0800
MIME-Version: 1.0
Content-Type: multipart/related;
type="text/html";
boundary="----=_NextPart_000_0000_01C96886.5E383CA0"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
This is a multi-part message in MIME format.
------=_NextPart_000_0000_01C96886.5E383CA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.naughter.com/serialport.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>CSerialPort v1.27</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1"><LINK=20
href=3D"http://www.naughter.com/naughter.css" type=3Dtext/css =
rel=3Dstylesheet>
<META content=3D"MSHTML 6.00.6000.16587" name=3DGENERATOR></HEAD>
<BODY>
<H2 align=3Dcenter><IMG height=3D254 alt=3D"Naughter Software Logo"=20
src=3D"http://www.naughter.com/images/logo.gif" width=3D419></H2>
<H2><IMG height=3D38 alt=3D"CSerialPort Logo"=20
src=3D"http://www.naughter.com/images/serialport.gif" width=3D40 =
border=3D0> <A=20
href=3D"http://www.naughter.com/download/serialport.zip">CSerialPort =
v1.27</A>=20
<I>An MFC class for Win32 serial ports</I></H2>
<P>Welcome to <STRONG>CSerialPort</STRONG>, an MFC class to support =
access to=20
the Win32 APIs dealing with serial ports.</P>
<P>
<H2>Features</H2>
<UL>
<LI>Simple and clean C++ interface.=20
<LI>Uses C++ exceptions in preference to the normal Win32 return value =
mechanism. This ensures that code which uses CSerialPort is more =
robust.=20
<LI>Unicode enabled, supports linking to MFC statically and all code =
compiles=20
cleanly at warning level 4.=20
<LI>Supports overlapped, blocking and call-back usage models of the =
serial=20
port. (Note Call-back is not supported on Windows 9x). </LI></UL>
<P> </P>
<P>The <A =
href=3D"http://www.naughter.com/download/serialport.zip">enclosed zip=20
file</A> contains the CSerialPort source code and a simple test program =
which=20
exercises all class API's.</P>
<P> </P>
<H2>Copyright</H2>
<UL>
<LI>You are allowed to include the source code in any product =
(commercial,=20
shareware, freeware or otherwise) when your product is released in =
binary=20
form.=20
<LI>You are allowed to modify the source code in any way you want =
except you=20
cannot modify the copyright details at the top of each module.=20
<LI>If you want to distribute source code with your application, then =
you are=20
only allowed to distribute versions released by the author. This is to =
maintain a single distribution point for the source code. </LI></UL>
<P> </P>
<H2>Updates</H2>
<P><STRONG>V1.0 (31 May 1999) </STRONG>
<UL>
<LI>Initial public release. </LI></UL>
<P><STRONG>V1.01 (3 June 1999)</STRONG>=20
<UL>
<LI>Fixed problem with code using CancelIo function which does not =
exist on=20
Windows 95. This caused any modules developed with CSerialPort to fail =
to load=20
on Windows 95.=20
<LI>Fixed leaks which can occur in sample app when an exception is =
thrown.=20
</LI></UL>
<P><STRONG>V1.02 (16 June 1999)</STRONG>=20
<UL>
<LI>Fixed a bug whereby CString::ReleaseBuffer was not being called in =
CSerialException::GetErrorMessage </LI></UL>
<P><STRONG>V1.03 (29 September 1999)</STRONG>=20
<UL>
<LI>Fixed a simple copy and paste bug in CSerialPort::SetDTR =
</LI></UL>
<P><STRONG>V1.04 (8 March 2000)</STRONG>=20
<UL>
<LI>Links in the documentation now work <g>. </LI></UL>
<P><STRONG>V1.05 (8 May 2000)</STRONG>=20
<UL>
<LI>Fixed an unreferenced variable in CSerialPort::GetOverlappedResult =
in VC 6=20
</LI></UL>
<P><STRONG>V1.06 (12 June 2000)</STRONG>=20
<UL>
<LI>Fixed another unreferenced variable problem in=20
CSerialPortApp::InitInstance in VC 6. </LI></UL>
<P><STRONG>3 July 2000</STRONG>=20
<UL>
<LI>Minor update to the documentation. </LI></UL>
<P><STRONG>V1.07 (10 December 2000)</STRONG>=20
<UL>
<LI>Made class destructor virtual. </LI></UL>
<P><STRONG>V1.08 (15 January 2001)</STRONG>=20
<UL>
<LI>Attach method now also allows you to specify whether the serial =
port is=20
being attached to in overlapped mode=20
<LI>Removed some ASSERT's which were unnecessary in some of the =
functions=20
<LI>Updated the Read method which uses OVERLAPPED IO to also return =
the bytes=20
read. This allows calls to WriteFile with a 0'ized overlapped =
structure (This=20
is required when dealing with TAPI and serial communications)=20
<LI>Now includes copyright message in the source code and =
documentation.=20
</LI></UL>
<P><STRONG>V1.09 (24 March 2001)</STRONG>=20
<UL>
<LI>Added a BytesWaiting method </LI></UL>
<P><STRONG>V1.10 (4 April 2001)</STRONG>=20
<UL>
<LI>Provided an overridden version of BytesWaiting which specifies a =
timeout.=20
</LI></UL>
<P><STRONG>V1.11 (23 April 2001)</STRONG>=20
<UL>
<LI>Fixed a memory leak in DataWaiting method. </LI></UL>
<P><STRONG>V1.12 (1 May 2002)</STRONG>=20
<UL>
<LI>Fixed a problem in Open method which was failing to initialize the =
DCB=20
structure incorrectly, when calling GetState. Thanks to Ben Newson for =
this=20
fix. </LI></UL>
<P><STRONG>V1.13 (29 May 2002)</STRONG>=20
<UL>
<LI>Fixed an problem where the GetProcAddress for CancelIO was using =
the wrong=20
calling convention. </LI></UL>
<P><STRONG>V1.14 (7 August 2002)</STRONG>=20
<UL>
<LI>Changed the declaration of CSerialPort::WaitEvent to be consistent =
with=20
the rest of the methods in CSerialPort which can operate in =
"OVERLAPPED" mode.=20
A note about the usage of this: If the method succeeds then the =
overlapped=20
operation has completed synchronously and there is no need to do a=20
WaitForSingle/Multiple]Object. If any other unexpected error occurs =
then a=20
CSerialException will be thrown. See the implementation of the=20
CSerialPort::DataWaiting which has been rewritten to use this new =
design=20
pattern. Thanks to Serhiy Pavlov for spotting this inconsistency. =
</LI></UL>
<P><STRONG>V1.15 (20 September 2002)</STRONG>=20
<UL>
<LI>Addition of an additional ASSERT in the internal _OnCompletion =
function.=20
<LI>Addition of an optional out parameter to the Write method which =
operates=20
in overlapped mode. Thanks to Kevin Pinkerton for this addition. =
</LI></UL>
<P><STRONG>5 March 2003</STRONG>
<UL>
<LI>Updated the documentation for the function CSerialPort::GetStatus. =
</LI></UL>
<P><STRONG>v1.16 (10 April 2006)</STRONG>
<UL>
<LI>Updated copyright details.=20
<LI>Addition of a CSERIALPORT_EXT_CLASS and CSERIALPORT_EXT_API macros =
which=20
makes the class easier to use in an extension dll.=20
<LI>Removed derivation of CSerialPort from CObject as it was not =
really=20
needed.=20
<LI>Fixed a number of level 4 warnings in the sample app.=20
<LI>Reworked the overlapped IO methods to expose the LPOVERLAPPED =
structure to=20
client code.=20
<LI>Updated the documentation to use the same style as the web site.=20
<LI>Did a spell check of the HTML documentation.=20
<LI>Updated the documentation on possible blocking in Read/Ex =
function. Thanks=20
to D Kerrison for reporting this issue.=20
<LI>Fixed a minor issue in the sample app when the code is compiled =
using=20
/Wp64 </LI></UL>
<P><STRONG>v1.17 (2 June 2006)</STRONG>
<UL>
<LI>Removed the bOverlapped as a member variable from the class. There =
was no=20
real need for this setting, since the SDK functions will perform their =
own=20
checking of how overlapped operations should=20
<LI>Fixed a bug in GetOverlappedResult where the code incorrectly =
checking=20
against the error ERROR_IO_PENDING instead of ERROR_IO_INCOMPLETE. =
Thanks to=20
Sasho Darmonski for reporting this bug.=20
<LI>Reviewed all TRACE statements for correctness. </LI></UL>
<P><STRONG>v1.18 (5 June 2006)</STRONG>
<UL>
<LI>Fixed an issue with the creation of the internal event object. It =
was=20
incorrectly being created as an auto-reset event object instead of a =
manual=20
reset event object. Thanks to Sasho Darmonski for reporting this =
issue.=20
</LI></UL>
<P><STRONG>v1.19 (24 June 2006)</STRONG>
<UL>
<LI>Fixed some typos in the history list. Thanks to Simon Wong for =
reporting=20
this.=20
<LI>Made the class which handles the construction of function pointers =
at=20
runtime a member variable of CSerialPort=20
<LI>Made AfxThrowSerialPortException part of the CSerialPort class. =
Thanks to=20
Simon Wong for reporting this.=20
<LI>Removed the unnecessary CSerialException destructor. Thanks to =
Simon Wong=20
for reporting this.=20
<LI>Fixed a minor error in the TRACE text in =
CSerialPort::SetDefaultConfig.=20
Again thanks to Simon Wong for reporting this.=20
<LI>Code now uses new C++ style casts rather than old style C casts =
where=20
necessary. Again thanks to Simon Wong for reporting this.=20
<LI>CSerialException::GetErrorMessage now uses the strsafe functions. =
This=20
does mean that the code now requires the Platform SDK if compiled =
using VC 6.=20
</LI></UL>
<P><STRONG>v1.20 (25 June 2006)</STRONG>
<UL>
<LI>Combined the functionality of the CSerialPortData class into the =
main=20
CSerialPort class.=20
<LI>Renamed AfxThrowSerialPortException to ThrowSerialPortException =
and made=20
the method public. </LI></UL>
<P><STRONG>v1.21 (5 November 2006)</STRONG>
<UL>
<LI>Minor update to stdafx.h of sample app to avoid compiler warnings =
in VC=20
2005.=20
<LI>Reverted the use of the strsafe.h header file. Instead now the =
code uses=20
the VC 2005 Safe CRT and if this is not available, then we fail back =
to the=20
standard CRT. </LI></UL>
<UL>
<LI>Minor update to remove strsafe.h from stdafx.h of the sample app.=20
<LI>Updated copyright details. </LI></UL>
<P><STRONG>v1.22 (25 January 2007)</STRONG>
<UL>
<LI>Minor update to remove strsafe.h from stdafx.h of the sample app.=20
<LI>Updated copyright details. </LI></UL>
<P><STRONG>v1.23 (24 December 2007)</STRONG>
<UL>
<LI>CSerialException::GetErrorMessage now uses the=20
FORMAT_MESSAGE_IGNORE_INSERTS flag. For more information please see =
Raymond=20
Chen's blog at <A=20
=
href=3D"http://blogs.msdn.com/oldnewthing/archive/2007/11/28/6564257.aspx=
">http://blogs.msdn.com/oldnewthing/archive/2007/11/28/6564257.aspx</A>. =
Thanks to Alexey Kuznetsov for reporting this issue.=20
<LI>Simplified the code in CSerialException::GetErrorMessage somewhat. =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -