-
大小: 29.07MB文件類型: .rar金幣: 1下載: 0 次發布日期: 2023-07-16
- 語言: C/C++
- 標簽: MFC??CSerialPort??串口通信??
資源簡介
使用SerialPort類,在InitPort()函數中修改串口值為1或2,即可使用COM1或者2.
代碼片段和文件信息
//?CSerialPortComm.cpp?:?Defines?the?class?behaviors?for?the?application.
//
#include?“stdafx.h“
#include?“CSerialPortComm.h“
#include?“CSerialPortCommDlg.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CCSerialPortCommApp
BEGIN_MESSAGE_MAP(CCSerialPortCommApp?CWinApp)
//{{AFX_MSG_MAP(CCSerialPortCommApp)
//?NOTE?-?the?ClassWizard?will?add?and?remove?mapping?macros?here.
//????DO?NOT?EDIT?what?you?see?in?these?blocks?of?generated?code!
//}}AFX_MSG
ON_COMMAND(ID_HELP?CWinApp::onhelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CCSerialPortCommApp?construction
CCSerialPortCommApp::CCSerialPortCommApp()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
}
/////////////////////////////////////////////////////////////////////////////
//?The?one?and?only?CCSerialPortCommApp?object
CCSerialPortCommApp?theApp;
/////////////////////////////////////////////////////////////////////////////
//?CCSerialPortCommApp?initialization
BOOL?CCSerialPortCommApp::InitInstance()
{
AfxEnableControlContainer();
//?Standard?initialization
//?If?you?are?not?using?these?features?and?wish?to?reduce?the?size
//??of?your?final?executable?you?should?remove?from?the?following
//??the?specific?initialization?routines?you?do?not?need.
#ifdef?_AFXDLL
Enable3dControls(); //?Call?this?when?using?MFC?in?a?shared?DLL
#else
Enable3dControlsStatic(); //?Call?this?when?linking?to?MFC?statically
#endif
CCSerialPortCommDlg?dlg;
m_pMainWnd?=?&dlg;
int?nResponse?=?dlg.DoModal();
if?(nResponse?==?IDOK)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?OK
}
else?if?(nResponse?==?IDCANCEL)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?Cancel
}
//?Since?the?dialog?has?been?closed?return?FALSE?so?that?we?exit?the
//??application?rather?than?start?the?application‘s?message?pump.
return?FALSE;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????38908??2014-11-06?21:55??CSerialPortComm\CSerialPortComm.aps
?????文件???????1434??2008-06-03?21:50??CSerialPortComm\CSerialPortComm.clw
?????文件???????2189??2008-04-29?15:53??CSerialPortComm\CSerialPortComm.cpp
?????文件???????4453??2008-04-29?15:57??CSerialPortComm\CSerialPortComm.dsp
?????文件????????555??2008-04-29?15:53??CSerialPortComm\CSerialPortComm.dsw
?????文件???????1423??2008-04-29?15:53??CSerialPortComm\CSerialPortComm.h
?????文件??????82944??2008-06-03?21:50??CSerialPortComm\CSerialPortComm.ncb
?????文件??????48640??2008-06-03?21:50??CSerialPortComm\CSerialPortComm.opt
?????文件????????264??2008-06-03?21:50??CSerialPortComm\CSerialPortComm.plg
?????文件???????5484??2014-11-06?21:55??CSerialPortComm\CSerialPortComm.rc
?????文件???51073024??2014-11-06?21:56??CSerialPortComm\CSerialPortComm.sdf
?????文件????????896??2014-11-06?21:29??CSerialPortComm\CSerialPortComm.sln
????..A..H.?????14848??2014-11-06?21:56??CSerialPortComm\CSerialPortComm.suo
?????文件???????7950??2014-11-06?21:29??CSerialPortComm\CSerialPortComm.vcxproj
?????文件???????2160??2014-11-06?21:28??CSerialPortComm\CSerialPortComm.vcxproj.filters
?????文件????????143??2014-11-06?21:28??CSerialPortComm\CSerialPortComm.vcxproj.user
?????文件???????5458??2014-11-06?21:42??CSerialPortComm\CSerialPortCommDlg.cpp
?????文件???????1660??2008-04-30?13:31??CSerialPortComm\CSerialPortCommDlg.h
?????文件???????3364??2014-11-06?21:49??CSerialPortComm\Debug\cl.command.1.tlog
?????文件??????99768??2014-11-06?21:49??CSerialPortComm\Debug\CL.read.1.tlog
?????文件???????2578??2014-11-06?21:49??CSerialPortComm\Debug\CL.write.1.tlog
?????文件?????110592??2014-11-06?21:55??CSerialPortComm\Debug\CSerialPortComm.exe
?????文件????????667??2014-11-06?21:29??CSerialPortComm\Debug\CSerialPortComm.exe.em
?????文件????????732??2014-11-06?21:29??CSerialPortComm\Debug\CSerialPortComm.exe.em
?????文件????????381??2014-11-06?21:55??CSerialPortComm\Debug\CSerialPortComm.exe.intermediate.manifest
?????文件????1322456??2014-11-06?21:55??CSerialPortComm\Debug\CSerialPortComm.ilk
?????文件????????149??2014-11-06?21:55??CSerialPortComm\Debug\CSerialPortComm.lastbuildstate
?????文件???????2519??2014-11-06?21:55??CSerialPortComm\Debug\CSerialPortComm.log
?????文件?????130069??2014-11-06?21:29??CSerialPortComm\Debug\CSerialPortComm.obj
?????文件???20250624??2014-11-06?21:29??CSerialPortComm\Debug\CSerialPortComm.pch
............此處省略39個文件信息
- 上一篇:基于bluez5.50修改的gatt api庫
- 下一篇:MFC實現實時曲線顯示
評論
共有 條評論