2、p>#include#include#include#include#include//类型定义enumTBaudRate{br110=110,br300=300,br600=600,br1200=1200,br2400=2400,br4800=4800,br9600=9600,br14400=14400,br19200=19200,br38400=38400,br56000=56000,b
3、r57600=57600,br115200=115200};enumTComPortNumber{pnCOM1,pnCOM2,pnCOM3,pnCOM4,pnCOM5,pnCOM6,pnCOM7,pnCOM8,pnCOM9,pnCOM10,pnCOM11,pnCOM12,pnCOM13,pnCOM14,pnCOM15,pnCOM16};enumTParity{None,Odd,Even,Mark,Space};enumTStopBits{SB1,SB1_5,SB2};enumTDataBits{DB5,DB6,D
4、B7,DB8};enumTHwHandShaking{hhNone,hhNoneRTSON,hhRTSCTS};enumTSwHandShaking{shNone,shXonXoff};//输入缓冲区的默认大小constlongINPUTBUFFERSIZE=4096;//LineStatus位定义constintME_CTS=1;constintME_DSR=2;constintME_RING=4;constintME_RLSD=8;//DCB位定义constlongdcb_Binary=0x00000001;
5、constlongdcb_ParityCheck=0x00000002;constlongdcb_OutxCtsFlow=0x00000004;constlongdcb_OutxDsrFlow=0x00000008;constlongdcb_DtrControlMask=0x00000030;constlongdcb_DtrControlDisable=0x00000000;constlongdcb_DtrControlEnable=0x00000010;constlongdcb_DtrControlHandsh
6、ake=0x00000020;constlongdcb_DsrSensivity=0x00000040;constlongdcb_TXContinueOnXoff=0x00000080;constlongdcb_OutX=0x00000100;constlongdcb_InX=0x00000200;constlongdcb_ErrorChar=0x00000400;constlongdcb_NullStrip=0x00000800;constlongdcb_RtsControlMask=0x00003000;co
7、nstlongdcb_RtsControlDisable=0x00000000;constlongdcb_RtsControlEnable=0x00001000;constlongdcb_RtsControlHandShake=0x00002000;constlongdcb_RtsControlToggle=0x00003000;constlongdcb_AbortOnError=0x00004000;constlongdcb_Reserveds=0xFFFF8000;//事件函数定位器声明typedefvoid
8、__fastcall(__closure*TReceiveDataEvent)(System::TObject*Sender);typedefvoid__fastcall(__closure*TReceiveErrorEvent)(System::TObject*Sender,DWORDEventMask);typedefvoid__fastcall(__closure*