91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

基于 http://blog.csdn.net/liquanhai/article/details/6941574 CSerialPort串口類最新修正版(解決關閉死鎖問題)2014-01-11 - 木木- 博客頻道- CSDN.NET.htm SerialPortDemo_Unicode[基于2014-12-18版SerialPort類Rn修改支持Unicode編碼的基于對話框版]

資源截圖

代碼片段和文件信息

/*
** FILENAME CSerialPort.cpp
**
** PURPOSE This?class?can?read?write?and?watch?one?serial?port.
** It?sends?messages?to?its?owner?when?something?happends?on?the?port
** The?class?creates?a?thread?for?reading?and?writing?so?the?main
** program?is?not?blocked.
**
** CREATION?DATE 15-09-1997
** LAST?MODIFICATION 12-11-1997
**
** AUTHOR Remon?Spekreijse
**
**??2007-12-25?mrlong????https://code.google.com/p/mycom/
**??2011-11-06?liquanhai?http://blog.csdn.net/liquanhai/article/details/6941574
**??2013-12-04?viruscamp
**??2014-12-18?liquanhai
** 2015-01-05?Rn
*/

#include?“stdafx.h“
#include?“SerialPort.h“

#include?
?
//
//?Constructor
//
CSerialPort::CSerialPort()
{
m_hComm?=?NULL;

//?initialize?overlapped?structure?members?to?zero
m_ov.Offset?=?0;
m_ov.OffsetHigh?=?0;

//?create?events
m_ov.hEvent?=?NULL;
m_hWriteEvent?=?NULL;
m_hShutdownEvent?=?NULL;

m_szWriteBuffer?=?NULL;

m_bThreadAlive?=?FALSE;
m_nWriteSize?=?1;
}

//
//?Delete?dynamic?memory
//
CSerialPort::~CSerialPort()
{
do
{
SetEvent(m_hShutdownEvent);
}?while?(m_bThreadAlive);

if?(m_hComm?!=?NULL)
{
CloseHandle(m_hComm);
m_hComm?=?NULL;
}
//?Close?Handles??
if(m_hShutdownEvent!=NULL)
CloseHandle(?m_hShutdownEvent);?
if(m_ov.hEvent!=NULL)
CloseHandle(?m_ov.hEvent?);?
if(m_hWriteEvent!=NULL)
CloseHandle(?m_hWriteEvent?);?

//TRACE(“Thread?ended\n“);

delete?[]?m_szWriteBuffer;
}

//
//?Initialize?the?port.?This?can?be?port?1?to?4.
//
//
//parity:
//??n=none
//??e=even
//??o=odd
//??m=mark
//??s=space
//data:
//??5678
//stop:
//??11.52?
//
BOOL?CSerialPort::InitPort(HWND?pPortOwner //?the?owner?(CWnd)?of?the?port?(receives?message)
???UINT??portnr //?portnumber?(1..4)
???UINT??baud //?baudrate
???char??parity //?parity?
???UINT??databits //?databits?
???UINT??stopbits //?stopbits?
???DWORD?dwCommEvents //?EV_RXCHAR?EV_CTS?etc
???UINT??writebuffersize//?size?to?the?writebuffer
???
???DWORD???ReadIntervalTimeout
???DWORD???ReadTotalTimeoutMultiplier
???DWORD???ReadTotalTimeoutConstant
???DWORD???WriteTotalTimeoutMultiplier
???DWORD???WriteTotalTimeoutConstant?)

{
assert(portnr?>?0?&&?portnr? assert(pPortOwner?!=?NULL);

//?if?the?thread?is?alive:?Kill
if?(m_bThreadAlive)
{
do
{
SetEvent(m_hShutdownEvent);
}?while?(m_bThreadAlive);
//TRACE(“Thread?ended\n“);
}

//?create?events
if?(m_ov.hEvent?!=?NULL)
ResetEvent(m_ov.hEvent);
else
m_ov.hEvent?=?CreateEvent(NULL?TRUE?FALSE?NULL);

if?(m_hWriteEvent?!=?NULL)
ResetEvent(m_hWriteEvent);
else
m_hWriteEvent?=?CreateEvent(NULL?TRUE?FALSE?NULL);

if?(m_hShutdownEvent?!=?NULL)
ResetEvent(m_hShutdownEvent);
else
m_hShutdownEvent?=?CreateEvent(NULL?TRUE?FALSE?NULL);

//?initialize?the?event?objects
m_hEventArray[0]?=?m_hShutdownEvent; //?highest?priority
m_hEventArray[1]?=?m_ov.hEvent;
m_hEventArray[2]?=?m_hWriteEvent;

/

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????947704??2015-01-05?19:37??SerialPortDemo_Unicode\debug\SerialPortDemo.ilk

?????文件???????2889??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo\ReadMe.txt

?????文件??????21630??2005-11-11?22:45??SerialPortDemo_Unicode\SerialPortDemo\res\SerialPortDemo.ico

?????文件????????370??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo\res\SerialPortDemo.rc2

?????文件????????535??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo\Resource.h

?????文件??????22369??2015-01-05?19:38??SerialPortDemo_Unicode\SerialPortDemo\SerialPort.cpp

?????文件???????5601??2015-01-05?19:38??SerialPortDemo_Unicode\SerialPortDemo\SerialPort.h

?????文件??????58760??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo\SerialPortDemo.aps

?????文件???????1753??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo\SerialPortDemo.cpp

?????文件????????514??2015-01-05?10:17??SerialPortDemo_Unicode\SerialPortDemo\SerialPortDemo.h

?????文件???????5129??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo\SerialPortDemo.rc

?????文件???????5601??2015-01-05?10:25??SerialPortDemo_Unicode\SerialPortDemo\SerialPortDemo.vcproj

?????文件???????1427??2015-01-05?19:37??SerialPortDemo_Unicode\SerialPortDemo\SerialPortDemo.vcproj.ATA-3579AD02262.FSMPC013.user

?????文件???????3027??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo\SerialPortDemoDlg.cpp

?????文件????????598??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo\SerialPortDemoDlg.h

?????文件????????145??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo\stdafx.cpp

?????文件???????2489??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo\stdafx.h

?????文件????????907??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo.sln

????..A..H.?????15872??2015-01-05?19:37??SerialPortDemo_Unicode\SerialPortDemo.suo

?????目錄??????????0??2015-01-05?19:37??SerialPortDemo_Unicode\SerialPortDemo\Debug

?????目錄??????????0??2015-01-05?10:15??SerialPortDemo_Unicode\SerialPortDemo\res

?????目錄??????????0??2015-01-05?19:37??SerialPortDemo_Unicode\debug

?????目錄??????????0??2015-01-05?19:38??SerialPortDemo_Unicode\SerialPortDemo

?????目錄??????????0??2015-01-05?19:39??SerialPortDemo_Unicode

-----------?---------??----------?-----??----

??????????????1097320????????????????????24


評論

共有 條評論