According to do online at http://wenku.baidu.com/view/ed1e5b73763231126fdb114e.html? The from=search,
But running appears invalid property value,
The program is as follows, thank you,
//XXX. The graduation design of a serial port Dlg CPP: implementation file
//
# include "stdafx. H"
Graduation design of a serial port # include "XXX. H"
# include "XXX graduation design the serial port of Dlg. H"
# include "afxdialogex. H"
# ifdef _DEBUG
# define new DEBUG_NEW
# endif
//for application "about" menu item CAboutDlg dialog
The class CAboutDlg: public CDialogEx
{
Public:
CAboutDlg ();
//data dialog
Enum {IDD=IDD_ABOUTBOX};
Protected:
Virtual void DoDataExchange (CDataExchange * symbol;//support DDX/DDV
//implementation
Protected:
DECLARE_MESSAGE_MAP ()
};
CAboutDlg: : CAboutDlg () : CDialogEx CAboutDlg: : (IDD)
{
}
Void CAboutDlg: : DoDataExchange (CDataExchange * symbol)
{
CDialogEx: : DoDataExchange (symbol);
}
BEGIN_MESSAGE_MAP (CAboutDlg CDialogEx)
END_MESSAGE_MAP ()
//CXXX graduation design of serial port Dlg dialog
CXXX graduation design: the serial port of Dlg: CXXX graduation design of serial port Dlg (pParent/*=NULL CWnd * */)
: CDialogEx (CXXX graduation design: the serial port of Dlg, IDD, pParent)
, m_EditReceive (_T (" "))
, m_Editsend (_T (" "))
{
M_hIcon=AfxGetApp () - & gt; LoadIcon (IDR_MAINFRAME);
}
Void CXXX graduation design: the serial port of Dlg: DoDataExchange (CDataExchange * symbol)
{
CDialogEx: : DoDataExchange (symbol);
DDX_Text (symbol, IDC_EDIT1 m_EditReceive);
DDX_Text (IDC_EDIT2 symbol, m_Editsend);
DDX_Control (symbol, IDC_COMBO1 m_comb1);
DDX_Control (symbol, IDC_COMBO2 m_comb2);
DDX_Control (symbol, IDC_MSCOMM1 m_mscom);
}
BEGIN_MESSAGE_MAP (CXXX graduation design, the serial port of Dlg CDialogEx)
ON_WM_SYSCOMMAND ()
ON_WM_PAINT ()
ON_WM_QUERYDRAGICON ()
ON_BN_CLICKED (IDC_BUTTON_OPEN, & amp; CXXX graduation design: the serial port of Dlg: OnBnClickedButtonOpen)
ON_BN_CLICKED (IDC_BUTTON_SEND, & amp; CXXX graduation design: the serial port of Dlg: OnBnClickedButtonSend)
ON_BN_CLICKED (IDC_BUTTON_CLEAN, & amp; CXXX graduation design: the serial port of Dlg: OnBnClickedButtonClean)
ON_BN_CLICKED (IDC_BUTTON_CLOSE, & amp; CXXX graduation design: the serial port of Dlg: OnBnClickedButtonClose)
ON_CBN_SELCHANGE (IDC_COMBO1, & amp; CXXX graduation design: the serial port of Dlg: OnCbnSelchangeCombo1)
END_MESSAGE_MAP ()
//message handler CXXX graduation design of a serial port Dlg
BOOL CXXX graduation design: the serial port of Dlg: OnInitDialog ()
{
CDialogEx: : OnInitDialog ();
//will "about... "Menu item added to the system menu,
//IDM_ABOUTBOX must be in the system command range,
ASSERT ((IDM_ABOUTBOX & amp; 0==IDM_ABOUTBOX xfff0));
ASSERT (IDM_ABOUTBOX & lt; 0 xf000);
CMenu * pSysMenu=GetSystemMenu (FALSE);
If (pSysMenu!=NULL)
{
BOOL bNameValid;
Cstrings strAboutMenu;
BNameValid=strAboutMenu. LoadString (IDS_ABOUTBOX);
ASSERT (bNameValid);
if (! StrAboutMenu. IsEmpty ())
{
PSysMenu - & gt; The AppendMenu (MF_SEPARATOR);
PSysMenu - & gt; AppendMenu (MF_STRING IDM_ABOUTBOX, strAboutMenu);
}
}
//set this dialog ICONS, when the application is the main window is not a dialog, the framework will automatically
//do this
SetIcon (m_hIcon, TRUE);//set the large icon
SetIcon (m_hIcon, FALSE);//set the small icon
//TODO: add additional initialization code in the
//serial port choice combo box
CString str;
int i;
for(i=0; i<15. I++)
{
STR. The Format (_T (" com % d) ", I + 1);
M_comb1. InsertString (I, STR);
}
M_comb1. SetCurSel (0);
//baud rate choice combo box
Cstrings str1 []={_T (" 300 "), _T (" 600 "), _T (" 1200 "), _T (" 2400 "), _T (" 4800 "), _T (" 9600 "),
_T (" 19200 "), _T (" 38400 "), _T (" 43000 "), _T (" 56000 "), _T (" 57600 "), _T (" 115200 ")};
for(int i=0; i<12. I++)
{
Int judge_tf=m_comb2. AddString (str1 [I]);
If ((judge_tf==CB_ERR) | | (judge_tf==CB_ERRSPACE))
MessageBox (_T (" build baud error!" ));
}
M_comb2. SetCurSel (5);
Return TRUE;//unless set focus to the control, return TRUE
}
Void CXXX graduation design: the serial port of Dlg, OnSysCommand (UINT nID, LPARAM LPARAM)
{
If ((nID & amp; 0 xfff0)==IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
DlgAbout. DoModal ();
}
The else
{
CDialogEx: : OnSysCommand (nID, lParam);
}
}
//if the dialog box to add a minimize button, you need the following code
//to draw the icon, to use the document/view model of MFC application,
//it will be done automatically by the framework,
Void CXXX graduation design: the serial port of Dlg, OnPaint ()
{
If (IsIconic ())
{
CPaintDC dc (this);//for drawing device context
The SendMessage (WM_ICONERASEBKGND, reinterpret_cast & lt; WPARAM> (dc) GetSafeHdc ()), 0);
//make the icon is centered within the workspace rectangular
Int cxIcon=GetSystemMetrics (SM_CXICON);
Int cyIcon=GetSystemMetrics (SM_CYICON);
CRect the rect.
GetClientRect (& amp; The rect);
Int x=(the rect. Width () - cxIcon + 1)/2;
Int y=(the rect. Height () - cyIcon + 1)/2;
//draw the icon
Dc. DrawIcon (x, y, m_hIcon);
}
The else
{
CDialogEx: : OnPaint ();
}
}
//when the user drag minimize window system call this function to obtain the cursor
//show,
HCURSOR CXXX graduation design: the serial port of Dlg: OnQueryDragIcon ()
{
Return static_cast & lt; HCURSOR> (m_hIcon);
}
Void CXXX graduation design: the serial port of Dlg: OnBnClickedButtonOpen ()
{
//TODO: add the control notification handler code
Cstrings STR, str1, n.
GetDlgItemText (IDC_BUTTON_OPEN, STR);
The CWnd * h1.
H1=GetDlgItem (IDC_BUTTON_OPEN);
if(! nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull