restore.cpp

来自「书友会短信发送系统由基础信息模块、短信管理模块、短信投票模块、系统管理模块等几部」· C++ 代码 · 共 75 行

CPP
75
字号
// Restore.cpp : implementation file
//

#include "stdafx.h"
#include "BookFriend.h"
#include "Restore.h"

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

/////////////////////////////////////////////////////////////////////////////
// CRestore dialog


CRestore::CRestore(CWnd* pParent /*=NULL*/)
	: CDialog(CRestore::IDD, pParent)
{
	//{{AFX_DATA_INIT(CRestore)
	m_Phone = _T("");
	m_Text = _T("");
	//}}AFX_DATA_INIT
}


void CRestore::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CRestore)
	DDX_Text(pDX, IDC_EDIT1, m_Phone);
	DDX_Text(pDX, IDC_EDIT2, m_Text);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CRestore, CDialog)
	//{{AFX_MSG_MAP(CRestore)
	ON_BN_CLICKED(IDC_BUTTONSEND, OnButtonsend)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CRestore message handlers

void CRestore::OnButtonsend() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	CString port,baud,merid,accredit;
	char buf[128];
	GetPrivateProfileString("短信猫设置","端口号","default",buf,128,"./NoteSet.ini");
	port.Format("%s",buf);
	GetPrivateProfileString("短信猫设置","波特率","default",buf,128,"./NoteSet.ini");
	baud.Format("%s",buf);
	GetPrivateProfileString("短信猫设置","机器号码","default",buf,128,"./NoteSet.ini");
	merid.Format("%s",buf);
	GetPrivateProfileString("短信猫设置","授权号码","default",buf,128,"./NoteSet.ini");
	accredit.Format("%s",buf);

	if(GSMModemInitNew((char*)(LPCTSTR)port,(char*)(LPCTSTR)baud,
		NULL,NULL,FALSE,(char*)(LPCTSTR)accredit)==FALSE)
	{
		MessageBox((char*)GSMModemGetErrorMsg());
		return;
	}
	if(GSMModemSMSsend(NULL,8,(char*)(LPCTSTR)m_Text,m_Text.GetLength(),
		(char*)(LPCTSTR)m_Phone,FALSE))
	{
		MessageBox("发送成功");
	}
	CDialog::OnCancel();
}

⌨️ 快捷键说明

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