资源简介

RS232串口通讯DLL源代码,在VC++6.0下编译通过.

资源截图

代码片段和文件信息

#include
#include “RS232dll.h“

bool OpenSerial(CString m_sPort)
{
COMMTIMEOUTS TimeOuts;

if (m_bOpen)
{
return TRUE;
}

    m_hCom = CreateFile(m_sPort // communication port string (COMX)
     GENERIC_READ | GENERIC_WRITE // read/write types
     0 // comm devices must be opened with exclusive access
     NULL // no security attributes
     OPEN_EXISTING // comm devices must use OPEN_EXISTING
     FILE_FLAG_OVERLAPPED // Async I/O
     0);

DCB dcb;
dcb.DCBlength = sizeof(DCB);
dcb.BaudRate = 9600; // 波特率
dcb.fParity = FALSE;
dcb.ByteSize = 8; // 每字节位数
dcb.Parity = NOPARITY;//无奇偶检验
dcb.StopBits = ONESTOPBIT;//1个停止位

if (m_hCom == INVALID_HANDLE_VALUE)
{
return FALSE;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件    1318982  2008-10-06 15:40  RS232dll\Debug\RS232dll.dll

     文件        893  2008-10-06 15:40  RS232dll\Debug\RS232dll.exp

     文件    1700544  2008-10-06 15:40  RS232dll\Debug\RS232dll.ilk

     文件       2504  2008-10-06 15:40  RS232dll\Debug\RS232dll.lib

     文件      10519  2008-10-06 15:39  RS232dll\Debug\RS232dll.obj

     文件    2517916  2008-10-06 15:39  RS232dll\Debug\RS232dll.pch

     文件    2688000  2008-10-06 15:40  RS232dll\Debug\RS232dll.pdb

     文件     107520  2008-10-06 15:40  RS232dll\Debug\vc60.idb

     文件      53248  2008-10-06 15:39  RS232dll\Debug\vc60.pdb

     文件       2354  2008-10-06 15:39  RS232dll\RS232dll.cpp

     文件       4136  2008-10-06 09:07  RS232dll\RS232dll.dsp

     文件        524  2008-10-06 09:06  RS232dll\RS232dll.dsw

     文件        545  2008-10-06 15:39  RS232dll\RS232dll.h

     文件      41984  2008-10-06 15:55  RS232dll\RS232dll.ncb

     文件      53760  2008-10-06 15:55  RS232dll\RS232dll.opt

     文件        843  2008-10-06 15:40  RS232dll\RS232dll.plg

     目录          0  2008-10-06 15:40  RS232dll\Debug

     目录          0  2008-10-06 15:55  RS232dll

----------- ---------  ---------- -----  ----

              8504272                    18


评论

共有 条评论