版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、利用MSCOMM串口通信控件進行異步串行通信的VC程序設(shè)計一 課程設(shè)計題目 利用MSCOMM串口通信控件進行異步串行通信的VC程序設(shè)計二 課程設(shè)計要求 環(huán)境要求:Windows95/98/2000/XP功能要求:能將鍵盤上輸入的數(shù)據(jù)發(fā)送到另一臺計算機上;能將接收到的數(shù)據(jù)顯示到屏幕窗口內(nèi);了解常用通信網(wǎng)絡(luò)設(shè)備的操作和應(yīng)用,掌握常用的通信協(xié)議的工作原理,能利用Visual C+、開發(fā)工具完成相應(yīng)的通信程序的設(shè)計工作。學(xué)習簡明地介紹自己的設(shè)計工作。三 課程設(shè)計目的 用Visual C+編程工具主機提供的接口,解決網(wǎng)絡(luò)用戶之間的交互式對話問題。進一步深入掌握網(wǎng)絡(luò)設(shè)計和通信程序的設(shè)計原理。使學(xué)生對計算機
2、通信網(wǎng)絡(luò)的設(shè)計實現(xiàn)有較深的了解,培養(yǎng)較高的通信網(wǎng)絡(luò)設(shè)計能力。四 程序思路硬件連接方面:數(shù)據(jù)的發(fā)送和接收由軟件控制,不進行硬件握手,其連接方法如圖真正需要互相連接的是RXD、TXD和GND;軟件方面:串行端口的本質(zhì)功能是作為CPU和串行設(shè)備間的編碼轉(zhuǎn)換器。當數(shù)據(jù)從 CPU經(jīng)過串行端口發(fā)送出去時,字節(jié)數(shù)據(jù)轉(zhuǎn)換為串行的位。在接收數(shù)據(jù)時,串行的位被轉(zhuǎn)換為字節(jié)數(shù)據(jù)在Windows環(huán)境(Windows NT、Win98、Windows2000)下,串口是系統(tǒng)資源的一部分。應(yīng)用程序要使用串口進行通信,必須在使用之前向操作系統(tǒng)提出資源申請要求(打開串口),通信完成后必須釋放資源(關(guān)閉串口)。VC+ 6.0提供
3、的MSComm控件通過串行端口發(fā)送和接收數(shù)據(jù),為應(yīng)用程序提供串行通信功能。使用非常方便。在當前的Workspace中插入MSComm控件。在mscomm.h中加入MSComm控件。protected: CMSComm m_ComPort;在mscomm.cpp:OnCreare(中:DWORD style=WS_VISIBLE|WS_CHILD; if (!m_ComPort.Create(NULL,style,CRect(0,0,0,0,this,ID_COMMCTRLTRACE0("Failed to create OLE Communications Controln"
4、;return -1; / fail to create.打開并初始化串口void CComDlg:OnOpencom( if(m_Com.GetPortOpen( /打開通信端口m_Com.SetPortOpen(FALSE;m_Com.SetCommPort(1; /選擇com1if( !m_Com.GetPortOpen(m_Com.SetPortOpen(TRUE;/打開串口MessageBox("串口已經(jīng)打開"elseMessageBox("不能打開串口!"m_Com.SetSettings("9600,n,8,1" /波特
5、率9600,無校驗,8個數(shù)據(jù)位,1個停止位 /以字符串的形式設(shè)置并返回波特率、奇偶校驗、數(shù)據(jù)位、停止位m_Com.SetInputMode(1; / 定義Input屬性獲取數(shù)據(jù)的方式(為0:文本方式;為1:二進制方式)。m_Com.SetRThreshold(1; /為1表示有一個字符引發(fā)一個事件m_Com.SetInputLen(0; /設(shè)置每次Input讀入的字符個數(shù),缺省值為0,表明讀取接收緩沖區(qū)中的全部內(nèi)容m_Com.GetInput(;m_opened=TRUE;捕捉串口事項。MSComm控件可以采用輪詢或事件驅(qū)動的方法從端口獲取數(shù)據(jù)。我們介紹比較使用的事件驅(qū)動方法:有事件(如接收到
6、數(shù)據(jù))時通知程序。在程序中需要捕獲并處理這些通訊事件。在MainFrm.h中:protected:afx_msg void OnCommMscomm(;DECLARE_EVENTSINK_MAP(在ComDlg.cpp中:BEGIN_EVENTSINK_MAP(CComDlg, CDialog/AFX_EVENTSINK_MAP(CComDlgON_EVENT(CComDlg, IDC_MSCOMM2, 1 /* OnComm */, OnComm, VTS_NONE/AFX_EVENTSINK_MAPEND_EVENTSINK_MAP( / 映射ActiveX控件串口讀寫.完成讀寫的函數(shù)的確
7、很簡單,GetInput(和SetOutput(就可。兩個函數(shù)的原型是:VARIANT GetInput(;及 void SetOutput(const VARIANT& newValue;都要使用VARIANT類型(所有Idispatch:Invoke的參數(shù)和返回值在內(nèi)部都是作為VARIANT對象處理的)。無論是在PC機讀取上傳數(shù)據(jù)時還是在PC機發(fā)送下行命令時,我們都習慣于使用字符串的形式(也可以說是數(shù)組形式)。查閱VARIANT文檔知道,可以用BSTR表示字符串,但遺憾的是所有的BSTR都是包含寬字符,即使我們沒有定義_UNICODE_UNICODE也是這樣! WinNT支持寬字符
8、, 而Win95并不支持。為解決上述問題,我們在實際工作中使用CbyteArray,給出相應(yīng)的部分程序如下:void CComDlg:OnComm( / TODO: Add your control notification handler code hereVARIANT variant_inp;COleSafeArray safearray_inp;LONG len,k;BYTE rxdata2048; CString strtemp;if(m_Com.GetCommEvent(=2 variant_inp=m_Com.GetInput(; safearray_inp=variant_in
9、p;len=safearray_inp.GetOneDimSize(;for(k=0;k safearray_inp.GetElement(&k,rxdata+k;for(k=0;k BYTE bt=*(char*(rxdata+k; strtemp.Format("%c",bt; m_recv+=strtemp; UpdateData(FALSE;五 程序調(diào)試運行程序后顯示用戶交互界面:打開串口:在一臺終端上的輸入情況:在另一臺終端上的輸出情況:六 心得體會對于這次課程設(shè)計,對于自己來說是個比較大的挑戰(zhàn),因為以前從沒有做過這樣的課程設(shè)計,即雙機通信。心理沒底,但是
10、要提高自己,就要做自己不敢做的事情。由于不懂,所以開始找了很多資料,對于雙機通信,理論知識我很快就掌握了,主要是串口的開啟與關(guān)閉,串口初始化以及串口的選擇,數(shù)據(jù)基本就可以傳輸了,經(jīng)過思考,發(fā)現(xiàn)理論知識比較簡單,但是我原來接觸的語言是C和java,從來沒有接觸過C+,感覺無從下手,而且熟悉visual C+環(huán)境也需要一段時間。萬事開頭難,剛剛開始的兩天思路很亂。后來仔細看了一下題目,是用mscomm控件來實現(xiàn),在網(wǎng)上查詢了相關(guān)資料后,發(fā)現(xiàn)mscomm的學(xué)習還是很簡單的,通過控件操作,竟然可以自動生成VC框架,這樣我自己就只要考慮串口的初始化和數(shù)據(jù)傳輸就可以了。VC具有強大的功能,能夠節(jié)約程序員的
11、時間,使程序員在編程時能很快地構(gòu)造出程序的框架,而專注于數(shù)據(jù)傳輸。數(shù)據(jù)傳輸實現(xiàn)就較為簡單了,不像文件傳輸,需要封裝文件。我參考網(wǎng)上實現(xiàn)串口的資料,然后就實現(xiàn)了程序的傳輸。這樣相當于單工通信。在程序傳輸實現(xiàn)之后,我還有一周的時間,我就在此基礎(chǔ)上進行改進,在程序中設(shè)置mscomm控制兩個串口,這樣就需要兩個mscomm控件,而硬件要求是,電腦中必須有兩個串口,但是一般電腦中只有一個串口,好在同學(xué)那里有一個擴展串口,我在一臺電腦上編實現(xiàn)了兩個串口的數(shù)據(jù)傳輸,相當于半雙工通信。七 附件程序Com.cpp #include "stdafx.h"#include "Com.h
12、"#include "ComDlg.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endifCComAppBEGIN_MESSAGE_MAP(CComApp, CWinAppON_COMMAND(ID_HELP, CWinApp:OnHelpEND_MESSAGE_MAP(/ CComApp constructionCComApp:CComApp( / The one and only CComApp objectCComApp theApp;
13、/ CComApp initializationBOOL CComApp:InitInstance(AfxEnableControlContainer(;#ifdef _AFXDLLEnable3dControls(; #elseEnable3dControlsStatic(; #endifCComDlg dlg;m_pMainWnd = &dlg;int nResponse = dlg.DoModal(;if (nResponse = IDOK else if (nResponse = IDCANCEL return FALSE;/ ComDlg.cpp : implementati
14、on file#include "stdafx.h"#include "Com.h"#include "ComDlg.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialogpublic:CAboutDlg(;enum IDD = IDD_ABOUTBOX ;protected:
15、virtual void DoDataExchange(CDataExchange* pDX; protected:DECLARE_MESSAGE_MAP(;CAboutDlg:CAboutDlg( : CDialog(CAboutDlg:IDD void CAboutDlg:DoDataExchange(CDataExchange* pDXCDialog:DoDataExchange(pDX;BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEND_MESSAGE_MAP(/ CComDlg dialogCComDlg:CComDlg(CWnd* pParent /*=
16、NULL*/: CDialog(CComDlg:IDD, pParentm_recv = _T(""m_send = _T(""m_hIcon = AfxGetApp(->LoadIcon(IDR_MAINFRAME;void CComDlg:DoDataExchange(CDataExchange* pDXCDialog:DoDataExchange(pDX;DDX_Control(pDX, IDC_MSCOMM2, m_Com;DDX_Text(pDX, IDC_RECV, m_recv;DDX_Text(pDX, IDC_SEND, m_se
17、nd;BEGIN_MESSAGE_MAP(CComDlg, CDialogON_WM_SYSCOMMAND(ON_WM_PAINT(ON_WM_QUERYDRAGICON(ON_BN_CLICKED(IDC_OPENCOM, OnOpencomON_BN_CLICKED(IDC_ONSEND, OnOnsendEND_MESSAGE_MAP(/ CComDlg message handlersBOOL CComDlg:OnInitDialog(CDialog:OnInitDialog(;ASSERT(IDM_ABOUTBOX & 0xFFF0 = IDM_ABOUTBOX;ASSERT
18、(IDM_ABOUTBOX < 0xF000;CMenu* pSysMenu = GetSystemMenu(FALSE;if (pSysMenu != NULLCString strAboutMenu;strAboutMenu.LoadString(IDS_ABOUTBOX;if (!strAboutMenu.IsEmpty(pSysMenu->AppendMenu(MF_SEPARATOR;pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu;SetIcon(m_hIcon, TRUE; SetIcon(m_
19、hIcon, FALSE; return TRUE; void CComDlg:OnSysCommand(UINT nID, LPARAM lParamif (nID & 0xFFF0 = IDM_ABOUTBOXCAboutDlg dlgAbout;dlgAbout.DoModal(;elseCDialog:OnSysCommand(nID, lParam;void CComDlg:OnPaint( if (IsIconic(CPaintDC dc(this;SendMessage(WM_ICONERASEBKGND, (WPARAM dc.GetSafeHdc(, 0int cxI
20、con = GetSystemMetrics(SM_CXICON;int cyIcon = GetSystemMetrics(SM_CYICON;CRect rect;GetClientRect(int x = (rect.Width( - cxIcon + 1 / 2;int y = (rect.Height( - cyIcon + 1 / 2;dc.DrawIcon(x, y, m_hIcon;elseCDialog:OnPaint(;HCURSOR CComDlg:OnQueryDragIcon(return (HCURSOR m_hIcon;void CComDlg:OnOpencom
21、( if(m_Com.GetPortOpen( /打開通信端口m_Com.SetPortOpen(FALSE;m_Com.SetCommPort(1; /選擇com1if( !m_Com.GetPortOpen(m_Com.SetPortOpen(TRUE;/打開串口MessageBox("串口已經(jīng)打開"elseMessageBox("不能打開串口!"m_Com.SetSettings("9600,n,8,1" m_Com.SetInputMode(1; m_Com.SetRThreshold(1; m_Com.SetInputLen
22、(0; m_Com.GetInput(;m_opened=TRUE;BEGIN_EVENTSINK_MAP(CComDlg, CDialogON_EVENT(CComDlg, IDC_MSCOMM2, 1 /* OnComm */, OnComm, VTS_NONEEND_EVENTSINK_MAP(void CComDlg:OnComm( VARIANT variant_inp;COleSafeArray safearray_inp;LONG len,k;BYTE rxdata2048; CString strtemp;if(m_Com.GetCommEvent(=2 variant_inp
23、=m_Com.GetInput(; safearray_inp=variant_inp;len=safearray_inp.GetOneDimSize(;for(k=0;k safearray_inp.GetElement(&k,rxdata+k;for(k=0;k BYTE bt=*(char*(rxdata+k; strtemp.Format("%c",bt; m_recv+=strtemp; UpdateData(FALSE;void CComDlg:OnOnsend( if(m_opened=TRUEGetDlgItem(IDC_SEND->GetWi
24、ndowText(m_send;if(m_send!="" UpdateData(TRUE;m_Com.SetOutput(COleVariant(m_send;m_send=" "UpdateData(FALSE;elseMessageBox("不能發(fā)空數(shù)據(jù)"elseMessageBox("請打開串口"Mscomm.cpp#include "stdafx.h"#include "mscomm.h"/ CMSCommIMPLEMENT_DYNCREATE(CMSComm, C
25、Wnd/ CMSComm properties/ CMSComm operationsvoid CMSComm:SetCDHolding(BOOL bNewValuestatic BYTE parms =VTS_BOOL;InvokeHelper(0x1, DISPATCH_PROPERTYPUT,VT_EMPTY, NULL, parms, bNewValue;BOOL CMSComm:GetCDHolding(BOOL result;InvokeHelper(0x1, DISPATCH_PROPERTYGET,VT_BOOL, (void*&result, NULL;return
26、result;void CMSComm:SetCommID(long nNewValuestatic BYTE parms =VTS_I4;InvokeHelper(0x3, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue;long CMSComm:GetCommID(long result;InvokeHelper(0x3, DISPATCH_PROPERTYGET,VT_I4, (void*&result, NULL;return result;void CMSComm:SetCommPort(short nNewVal
27、uestatic BYTE parms =VTS_I2;InvokeHelper(0x4, DISPATCH_PROPERTYPUT,VT_EMPTY, NULL, parms, nNewValue;short CMSComm:GetCommPort(short result;InvokeHelper(0x4, DISPATCH_PROPERTYGET, VT_I2, (void*&result, NULL;return result;void CMSComm:SetCTSHolding(BOOL bNewValuestatic BYTE parms =VTS_BOOL;InvokeH
28、elper(0x5, DISPATCH_PROPERTYPUT,VT_EMPTY, NULL, parms,bNewValue;BOOL CMSComm:GetCTSHolding(BOOL result;InvokeHelper(0x5, DISPATCH_PROPERTYGET,VT_BOOL, (void*&result, NULL;return result;void CMSComm:SetDSRHolding(BOOL bNewValuestatic BYTE parms =VTS_BOOL;InvokeHelper(0x7, DISPATCH_PROPERTYPUT,VT_
29、EMPTY, NULL, parms, bNewValue;BOOL CMSComm:GetDSRHolding(BOOL result;InvokeHelper(0x7, DISPATCH_PROPERTYGET, VT_BOOL, (void*&result, NULL;return result;void CMSComm:SetDTREnable(BOOL bNewValuestatic BYTE parms =VTS_BOOL;InvokeHelper(0x9, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,bNewValue;BOOL
30、 CMSComm:GetDTREnable(BOOL result;InvokeHelper(0x9, DISPATCH_PROPERTYGET,VT_BOOL, (void*&result, NULL;return result;void CMSComm:SetHandshaking(long nNewValuestatic BYTE parms =VTS_I4;InvokeHelper(0xa, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue;long CMSComm:GetHandshaking(long result
31、;InvokeHelper(0xa, DISPATCH_PROPERTYGET,VT_I4, (void*&result, NULL;return result;void CMSComm:SetInBufferSize(short nNewValuestatic BYTE parms =VTS_I2;InvokeHelper(0xb, DISPATCH_PROPERTYPUT,VT_EMPTY, NULL, parms, nNewValue;short CMSComm:GetInBufferSize(short result;InvokeHelper(0xb, DISPATCH_PRO
32、PERTYGET,VT_I2, (void*&result, NULL;return result;void CMSComm:SetInBufferCount(short nNewValuestatic BYTE parms =VTS_I2;InvokeHelper(0xc, DISPATCH_PROPERTYPUT,VT_EMPTY, NULL, parms, nNewValue;short CMSComm:GetInBufferCount(short result;InvokeHelper(0xc, DISPATCH_PROPERTYGET,VT_I2, (void*&re
33、sult, NULL;return result;void CMSComm:SetBreak(BOOL bNewValuestatic BYTE parms =VTS_BOOL;InvokeHelper(0xd, DISPATCH_PROPERTYPUT,VT_EMPTY, NULL, parms, bNewValue;BOOL CMSComm:GetBreak(BOOL result;InvokeHelper(0xd, DISPATCH_PROPERTYGET,VT_BOOL, (void*&result, NULL;return result;void CMSComm:SetInp
34、utLen(short nNewValuestatic BYTE parms =VTS_I2;InvokeHelper(0xe, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue;short CMSComm:GetInputLen(short result;InvokeHelper(0xe, DISPATCH_PROPERTYGET, VT_I2, (void*&result, NULL;return result;void CMSComm:SetNullDiscard(BOOL bNewValuestatic BYTE pa
35、rms =VTS_BOOL;InvokeHelper(0x10, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, bNewValue;BOOL CMSComm:GetNullDiscard(BOOL result;InvokeHelper(0x10, DISPATCH_PROPERTYGET, VT_BOOL, (void*&result, NULL;return result;void CMSComm:SetOutBufferSize(short nNewValuestatic BYTE parms =VTS_I2;InvokeHelper(
36、0x11, DISPATCH_PROPERTYPUT,VT_EMPTY, NULL, parms, nNewValue;short CMSComm:GetOutBufferSize(short result;InvokeHelper(0x11, DISPATCH_PROPERTYGET, VT_I2, (void*&result, NULL;return result;void CMSComm:SetOutBufferCount(short nNewValuestatic BYTE parms =VTS_I2;InvokeHelper(0x12, DISPATCH_PROPERTYPU
37、T,VT_EMPTY, NULL, parms, nNewValue;short CMSComm:GetOutBufferCount(short result;InvokeHelper(0x12, DISPATCH_PROPERTYGET, VT_I2, (void*&result, NULL;return result;void CMSComm:SetParityReplace(LPCTSTR lpszNewValuestatic BYTE parms =VTS_BSTR;InvokeHelper(0x13, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL,
38、 parms, lpszNewValue;CString CMSComm:GetParityReplace(CString result;InvokeHelper(0x13, DISPATCH_PROPERTYGET, VT_BSTR, (void*&result, NULL;return result;void CMSComm:SetPortOpen(BOOL bNewValuestatic BYTE parms =VTS_BOOL;InvokeHelper(0x14, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, bNewValue;BO
39、OL CMSComm:GetPortOpen(BOOL result;InvokeHelper(0x14, DISPATCH_PROPERTYGET, VT_BOOL, (void*&result, NULL;return result;void CMSComm:SetRThreshold(short nNewValuestatic BYTE parms =VTS_I2;InvokeHelper(0x15, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue;short CMSComm:GetRThreshold(short r
40、esult;InvokeHelper(0x15, DISPATCH_PROPERTYGET, VT_I2, (void*&result, NULL;return result;void CMSComm:SetRTSEnable(BOOL bNewValuestatic BYTE parms =VTS_BOOL;InvokeHelper(0x16, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, bNewValue;BOOL CMSComm:GetRTSEnable(BOOL result;InvokeHelper(0x16, DISPATCH_
41、PROPERTYGET, VT_BOOL, (void*&result, NULL;return result;void CMSComm:SetSettings(LPCTSTR lpszNewValuestatic BYTE parms =VTS_BSTR;InvokeHelper(0x17, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, lpszNewValue;CString CMSComm:GetSettings(CString result;InvokeHelper(0x17, DISPATCH_PROPERTYGET, VT_BST
42、R, (void*&result, NULL;return result;void CMSComm:SetSThreshold(short nNewValuestatic BYTE parms =VTS_I2;InvokeHelper(0x18, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue;short CMSComm:GetSThreshold(short result;InvokeHelper(0x18, DISPATCH_PROPERTYGET, VT_I2, (void*&result, NULL;retu
43、rn result;void CMSComm:SetOutput(const VARIANT& newValuestatic BYTE parms =VTS_VARIANT;InvokeHelper(0x19, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, &newValue;VARIANT CMSComm:GetOutput(VARIANT result;InvokeHelper(0x19, DISPATCH_PROPERTYGET, VT_VARIANT, (void*&result, NULL;return result
44、;void CMSComm:SetInput(const VARIANT& newValuestatic BYTE parms =VTS_VARIANT;InvokeHelper(0x1a, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, &newValue;VARIANT CMSComm:GetInput(VARIANT result;InvokeHelper(0x1a, DISPATCH_PROPERTYGET, VT_VARIANT, (void*&result, NULL;return result;void CMSCo
45、mm:SetCommEvent(short nNewValuestatic BYTE parms =VTS_I2;InvokeHelper(0x1b, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue;short CMSComm:GetCommEvent(short result;InvokeHelper(0x1b, DISPATCH_PROPERTYGET, VT_I2, (void*&result, NULL;return result;void CMSComm:SetEOFEnable(BOOL bNewValuesta
46、tic BYTE parms =VTS_BOOL;InvokeHelper(0x1c, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,bNewValue;BOOL CMSComm:GetEOFEnable(BOOL result;InvokeHelper(0x1c, DISPATCH_PROPERTYGET, VT_BOOL, (void*&result, NULL;return result;void CMSComm:SetInputMode(long nNewValuestatic BYTE parms =VTS_I4;InvokeHelp
47、er(0x1d, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, nNewValue;long CMSComm:GetInputMode(long result;InvokeHelper(0x1d, DISPATCH_PROPERTYGET, VT_I4, (void*&result, NULL;return result;/ stdafx.cpp :#include "stdafx.h"/ Com.h#if !defined(AFX_COM_H_CC3DE67A_A6D3_4E95_B3A1_21B971A17C64_IN
48、CLUDED_#define AFX_COM_H_CC3DE67A_A6D3_4E95_B3A1_21B971A17C64_INCLUDED_#if _MSC_VER > 1000#pragma once#endif#ifndef _AFXWIN_H_#error include 'stdafx.h' before including this file for PCH#endif#include "resource.h" / CComApp:class CComApp : public CWinApppublic:CComApp(;public:vi
49、rtual BOOL InitInstance(;DECLARE_MESSAGE_MAP(;#endif#if !defined(AFX_COMDLG_H_2C5D9F44_AB0A_4501_A2B7_7BCA6EAB1B92_INCLUDED_#define AFX_COMDLG_H_2C5D9F44_AB0A_4501_A2B7_7BCA6EAB1B92_INCLUDED_#if _MSC_VER > 1000#pragma once#endif / _MSC_VER > 1000/ CComDlg dialogclass CComDlg : public CDialogpu
50、blic:BOOL m_opened;CComDlg(CWnd* pParent = NULL; enum IDD = IDD_COM_DIALOG ;CMSComm m_Com;CString m_recv;CString m_send;protected:virtual void DoDataExchange(CDataExchange* pDX; protected:HICON m_hIcon;virtual BOOL OnInitDialog(;afx_msg void OnSysCommand(UINT nID, LPARAM lParam;afx_msg void OnPaint(
51、;afx_msg HCURSOR OnQueryDragIcon(;afx_msg void OnOpencom(;afx_msg void OnComm(;afx_msg void OnOnsend(;DECLARE_EVENTSINK_MAP(DECLARE_MESSAGE_MAP(;#endif#if _MSC_VER > 1000#pragma once#endifclass CMSComm : public CWndprotected:DECLARE_DYNCREATE(CMSCommpublic:CLSID const& GetClsid(static CLSID c
52、onst clsid= 0x648a5600, 0x2c6e, 0x101b, 0x82, 0xb6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14 ;return clsid;virtual BOOL Create(LPCTSTR lpszClassName,LPCTSTR lpszWindowName, DWORD dwStyle,const RECT& rect,CWnd* pParentWnd, UINT nID,CCreateContext* pContext = NULL return CreateControl(GetClsid(, lpszWindowNa
53、me, dwStyle, rect, pParentWnd, nID; BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,const RECT& rect, CWnd* pParentWnd, UINT nID,CFile* pPersist = NULL, BOOL bStorage = FALSE,BSTR bstrLicKey = NULL return CreateControl(GetClsid(, lpszWindowName, dwStyle, rect, pParentWnd, nID,pPersist, bStorag
54、e, bstrLicKey; public:public:void SetCDHolding(BOOL bNewValue;BOOL GetCDHolding(;void SetCommID(long nNewValue;long GetCommID(;void SetCommPort(short nNewValue;short GetCommPort(;void SetCTSHolding(BOOL bNewValue;BOOL GetCTSHolding(;void SetDSRHolding(BOOL bNewValue;BOOL GetDSRHolding(;void SetDTREn
55、able(BOOL bNewValue;BOOL GetDTREnable(;void SetHandshaking(long nNewValue;long GetHandshaking(;void SetInBufferSize(short nNewValue;short GetInBufferSize(;void SetInBufferCount(short nNewValue;short GetInBufferCount(;void SetBreak(BOOL bNewValue;BOOL GetBreak(;void SetInputLen(short nNewValue;short GetInputLen(;void SetNullDiscard(BOOL bNewValue;BOOL GetNullDiscard(;void SetOutBufferSize(short nNewValue;short GetOutBufferSize(;void SetOutBufferCount(short nNewV
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度敬老院食堂餐飲承包協(xié)議
- 二零二五年度土地承包經(jīng)營權(quán)抵押擔保合同樣本3篇
- 二零二五年度情侶戀愛行為規(guī)范協(xié)議2篇
- 二零二五年度互聯(lián)網(wǎng)項目擔保人變更協(xié)議3篇
- 二零二五年度汽車抵押借款合同執(zhí)行標準2篇
- 資產(chǎn)評估課程設(shè)計電腦
- 體育場館布置方案范文(2篇)
- 二零二五年度水利工程設(shè)備安裝施工合同模板6篇
- 房建安全監(jiān)理細則模版(2篇)
- 透明傳輸課程設(shè)計
- GB/T 41837-2022溫泉服務(wù)溫泉水質(zhì)要求
- YS/T 79-2006硬質(zhì)合金焊接刀片
- 考研考博-英語-山東師范大學(xué)押題密卷附帶答案詳解篇
- 實用性閱讀與交流任務(wù)群設(shè)計思路與教學(xué)建議
- 中醫(yī)診療器具清洗消毒(醫(yī)院感染防控專家課堂培訓(xùn)課件)
- 通風設(shè)施標準
- 寵物智能用品項目計劃書【模板范文】
- 藥廠生產(chǎn)車間現(xiàn)場管理-PPT課件
- 軸與孔標準公差表
- 防火門施工方案
- 人教PEP版2022-2023六年級英語上冊期末試卷及答案(含聽力材料)
評論
0/150
提交評論