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

📄 test.cpp

📁 TC35源程序
💻 CPP
字号:
// Test.cpp : implementation file
//

#include "stdafx.h"
#include "CDMASMSS.h"
#include "Test.h"

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

/////////////////////////////////////////////////////////////////////////////
// CTest dialog
#include "CDMASMSSDlg.h"
extern CCDMASMSSDlg * CDMASMSSDlg;

CTest::CTest(CWnd* pParent /*=NULL*/)
	: CDialog(CTest::IDD, pParent)
{
	//{{AFX_DATA_INIT(CTest)
	m_send = _T("");
	//}}AFX_DATA_INIT
}


void CTest::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CTest)
	DDX_Control(pDX, IDC_EDIT1, m_controlsend);
	DDX_Text(pDX, IDC_EDIT1, m_send);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CTest, CDialog)
	//{{AFX_MSG_MAP(CTest)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CTest message handlers



void CTest::OnButton1() 
{
	// TODO: Add your control notification handler code here
	CString infor="AT+cmgr=1";
	m_send=infor;
	infor+="\r";
	if(CDMASMSSDlg->m_bOpen==false) MessageBox("请打开串口!");
	else
	{
CDMASMSSDlg->SendAT(infor);
UpdateData(false);
	}
}

void CTest::OnButton2() 
{
	// TODO: Add your control notification handler code here
	CString infor="AT+cmgd=1";
	m_send=infor;
	infor+="\r";
	if(CDMASMSSDlg->m_bOpen==false) MessageBox("请打开串口!");
	else
	{
CDMASMSSDlg->SendAT(infor);
UpdateData(false);
	}	
}

void CTest::OnButton3() 
{
	// TODO: Add your control notification handler code here
		UpdateData(true);
	CString infor=m_send;
	infor+="\r";
	if(CDMASMSSDlg->m_bOpen==false) MessageBox("请打开串口!");
	else
	{
		if(infor!="")
CDMASMSSDlg->SendAT(infor);
	}
}

BOOL CTest::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
			if(pMsg->message == WM_KEYDOWN)
	{
		if(pMsg->wParam == VK_RETURN)	
		{
               //MessageBox("aa");
		    	UpdateData(true);
			   m_send+="\r\n";
			   UpdateData(false);
				m_controlsend.SetWindowText(m_send);
		m_controlsend.SetFocus (); 
		int nLen=m_controlsend.GetWindowTextLength();
		m_controlsend.SetSel (nLen, nLen);
		int EditCount = m_controlsend.GetLineCount();
		m_controlsend.LineScroll( EditCount,0);
        }
		if( pMsg->wParam == VK_ESCAPE)
			return false;
    }
	return CDialog::PreTranslateMessage(pMsg);
}

⌨️ 快捷键说明

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