UnitComm.h
资源名称:第6章 多线程编程.rar [点击查看]
上传用户:gyjjlc
上传日期:2013-03-29
资源大小:2124k
文件大小:1k
源码类别:
多显示器编程
开发平台:
C++ Builder
- //---------------------------------------------------------------------------
- #ifndef UnitCommH
- #define UnitCommH
- #define BLOCK_LENGTH 1024
- #include "UnitMain.h"
- class TCommunication:public TObject
- {
- public:
- HANDLE hCom;
- __fastcall TCommunication();
- virtual __fastcall ~TCommunication();
- bool __fastcall ComInitialization(AnsiString DevicePort,
- int BaudRate,int ByteSize, int Parity, int StopBits);
- char * __fastcall ReceiveProcess();
- BOOL __fastcall WriteCommBlock(LPSTR lpBlock,DWORD nMaxLength);
- private:
- //接收缓冲区
- char Buffer[BLOCK_LENGTH+1];
- //接收缓冲区计数器,加1计数器
- DWORD BufferOffset;
- //分别为读、写重叠数据结构
- OVERLAPPED osRead,osWrite;
- DWORD __fastcall ReadCommBlock(LPSTR lpBlock,DWORD nMaxLength);
- };
- //---------------------------------------------------------------------------
- #endif
English
