📄 send.cpp
字号:
// Send.cpp : implementation file
//
#include "stdafx.h"
#include "CDMASMSS.h"
#include "Send.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSend dialog
#include "CDMASMSSDlg.h"
extern CCDMASMSSDlg * CDMASMSSDlg;
CSend::CSend(CWnd* pParent /*=NULL*/)
: CDialog(CSend::IDD, pParent)
{
//{{AFX_DATA_INIT(CSend)
m_phone = _T("");
m_content = _T("");
//}}AFX_DATA_INIT
}
void CSend::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSend)
DDX_Control(pDX, IDC_EDIT2, m_controlcontent);
DDX_Text(pDX, IDC_EDIT1, m_phone);
DDX_Text(pDX, IDC_EDIT2, m_content);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSend, CDialog)
//{{AFX_MSG_MAP(CSend)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSend message handlers
void CSend::OnButton1()
{
// TODO: Add your control notification handler code here
if(CDMASMSSDlg->m_bOpen==false) MessageBox("请打开串口!");
else
{
CString infor="AT+CMGF=1;+CNMI=1,1,0,0,1";
infor+="\r";
CDMASMSSDlg->SendAT(infor);
}
}
void CSend::OnButton2()
{
// TODO: Add your control notification handler code here
UpdateData(true);
if(CDMASMSSDlg->m_bOpen==false) MessageBox("请打开串口!");
else
{
if(m_phone!=""&&m_content!="")
CDMASMSSDlg->SendShortMessage(m_phone,m_content);
else MessageBox("电话号码和短信息内容不能为空!");
}
}
BOOL CSend::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_content+="\r\n";
UpdateData(false);
m_controlcontent.SetWindowText(m_content);
m_controlcontent.SetFocus ();
int nLen=m_controlcontent.GetWindowTextLength();
m_controlcontent.SetSel (nLen, nLen);
int EditCount = m_controlcontent.GetLineCount();
m_controlcontent.LineScroll( EditCount,0);
}
if(pMsg->wParam == VK_ESCAPE)
return false;
}
return CDialog::PreTranslateMessage(pMsg);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -