⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 portsetdlg.cpp

📁 用VC++API函数写的串口类
💻 CPP
字号:
// PortSetDlg.cpp : implementation file
//

#include "stdafx.h"
#include "SerialCom.h"
#include "PortSetDlg.h"
#include "Serial.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPortSetDlg dialog


CPortSetDlg::CPortSetDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPortSetDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPortSetDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CPortSetDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPortSetDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPortSetDlg, CDialog)
	//{{AFX_MSG_MAP(CPortSetDlg)
	ON_CBN_SELENDOK(IDC_COMBO1, OnSelendokCombo1)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPortSetDlg message handlers

BOOL CPortSetDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CComboBox *ComBox=(CComboBox*)GetDlgItem(IDC_COMBO1);
	ComBox->AddString("COM1");
    ComBox->AddString("COM2");
	ComBox->AddString("COM3");
	ComBox->AddString("COM4");
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPortSetDlg::OnSelendokCombo1() 
{
 	CComboBox *ComBox = (CComboBox*) GetDlgItem(IDC_COMBO1);
  	ComNum = ComBox->GetCurSel() + 1;

}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -