www.pudn.com > SMSDemoALL.zip > MobileSMSDemoDlg.cpp


// MobileSMSDemoDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "MobileSMSDemo.h" 
#include "MobileSMSDemoDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CAboutDlg dialog used for App About 
 
class CAboutDlg : public CDialog 
{ 
public: 
	CAboutDlg(); 
 
// Dialog Data 
	//{{AFX_DATA(CAboutDlg) 
	enum { IDD = IDD_ABOUTBOX }; 
	//}}AFX_DATA 
 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CAboutDlg) 
	protected: 
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support 
	//}}AFX_VIRTUAL 
 
// Implementation 
protected: 
	//{{AFX_MSG(CAboutDlg) 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) 
{ 
	//{{AFX_DATA_INIT(CAboutDlg) 
	//}}AFX_DATA_INIT 
} 
 
void CAboutDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CAboutDlg) 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) 
	//{{AFX_MSG_MAP(CAboutDlg) 
		// No message handlers 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMobileSMSDemoDlg dialog 
 
CMobileSMSDemoDlg::CMobileSMSDemoDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CMobileSMSDemoDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CMobileSMSDemoDlg) 
	m_bSMSNeedReport = FALSE; 
	m_lBattery = 0; 
	m_lComPort = 1; 
	m_strIMEI = _T(""); 
	m_strManufacture = _T(""); 
	m_strModel = _T(""); 
	m_strNetInfo = _T(""); 
	m_lPBIndex = 0; 
	m_strPBName = _T(""); 
	m_strPBPhone = _T(""); 
	m_strPBResult = _T(""); 
	m_lSignal = 0; 
	m_lSMSIndex = 0; 
	m_strSMSLogoFile = _T(""); 
	m_lSMSMCC = 0; 
	m_lSMSMNC = 0; 
	m_strSMSPhone = _T(""); 
	m_strSMSResult = _T(""); 
	m_strSMSRingtone = _T(""); 
	m_strSMSSMSC = _T(""); 
	m_strSMSText = _T(""); 
	m_lSMSValidity = 2880; 
	m_strTime = _T(""); 
	m_strVersion = _T(""); 
	m_lComBaudrate = 0; 
	m_lConnectionMode = 1; 
	m_lOptType = 0; 
	//}}AFX_DATA_INIT 
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32 
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); 
} 
 
void CMobileSMSDemoDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CMobileSMSDemoDlg) 
	DDX_Check(pDX, IDC_CHECK_SMS_NEED_REPORT, m_bSMSNeedReport); 
	DDX_Text(pDX, IDC_EDIT_BATTERY, m_lBattery); 
	DDX_Text(pDX, IDC_EDIT_COM_PORT, m_lComPort); 
	DDX_Text(pDX, IDC_EDIT_IMEI, m_strIMEI); 
	DDX_Text(pDX, IDC_EDIT_MANUFACTURE, m_strManufacture); 
	DDX_Text(pDX, IDC_EDIT_MODEL, m_strModel); 
	DDX_Text(pDX, IDC_EDIT_NET_INFO, m_strNetInfo); 
	DDX_Text(pDX, IDC_EDIT_PB_INDEX, m_lPBIndex); 
	DDX_Text(pDX, IDC_EDIT_PB_NAME, m_strPBName); 
	DDX_Text(pDX, IDC_EDIT_PB_PHONE, m_strPBPhone); 
	DDX_Text(pDX, IDC_EDIT_PB_RESULT, m_strPBResult); 
	DDX_Text(pDX, IDC_EDIT_SIGNAL, m_lSignal); 
	DDX_Text(pDX, IDC_EDIT_SMS_INDEX, m_lSMSIndex); 
	DDX_Text(pDX, IDC_EDIT_SMS_LOGO_FILE, m_strSMSLogoFile); 
	DDX_Text(pDX, IDC_EDIT_SMS_MCC, m_lSMSMCC); 
	DDX_Text(pDX, IDC_EDIT_SMS_MNC, m_lSMSMNC); 
	DDX_Text(pDX, IDC_EDIT_SMS_PHONE, m_strSMSPhone); 
	DDX_Text(pDX, IDC_EDIT_SMS_RESULT, m_strSMSResult); 
	DDX_Text(pDX, IDC_EDIT_SMS_RINGTONE, m_strSMSRingtone); 
	DDX_Text(pDX, IDC_EDIT_SMS_SMSC, m_strSMSSMSC); 
	DDX_Text(pDX, IDC_EDIT_SMS_TEXT, m_strSMSText); 
	DDX_Text(pDX, IDC_EDIT_SMS_VALIDITY, m_lSMSValidity); 
	DDX_Text(pDX, IDC_EDIT_TIME, m_strTime); 
	DDX_Text(pDX, IDC_EDIT_VERSION, m_strVersion); 
	DDX_CBIndex(pDX, IDC_COMBO_COM_BAUDRATE, m_lComBaudrate); 
	DDX_CBIndex(pDX, IDC_COMBO_CONNECTION_MODE, m_lConnectionMode); 
	DDX_Control(pDX, IDC_MOBILESMSCTRL, m_SMS); 
	DDX_CBIndex(pDX, IDC_COMBO_SMS_TYPE, m_lOptType); 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CMobileSMSDemoDlg, CDialog) 
	//{{AFX_MSG_MAP(CMobileSMSDemoDlg) 
	ON_WM_SYSCOMMAND() 
	ON_WM_PAINT() 
	ON_WM_QUERYDRAGICON() 
	ON_BN_CLICKED(IDC_BUTTON_CONNECT, OnButtonConnect) 
	ON_BN_CLICKED(IDC_BUTTON_DISCONNECT, OnButtonDisconnect) 
	ON_BN_CLICKED(IDC_BUTTON_REFRESH_INFO, OnButtonRefreshInfo) 
	ON_BN_CLICKED(IDC_BUTTON_SET_TIME, OnButtonSetTime) 
	ON_BN_CLICKED(IDC_BUTTON_SMS_REFRESH, OnButtonSmsRefresh) 
	ON_BN_CLICKED(IDC_BUTTON_PB_REFRESH, OnButtonPbRefresh) 
	ON_BN_CLICKED(IDC_BUTTON_GET_SMSC, OnButtonGetSmsc) 
	ON_BN_CLICKED(IDC_BUTTON_SET_SMSC, OnButtonSetSmsc) 
	ON_BN_CLICKED(IDC_BUTTON_PB_DELETE, OnButtonPbDelete) 
	ON_BN_CLICKED(IDC_BUTTON_SMS_DELETE, OnButtonSmsDelete) 
	ON_BN_CLICKED(IDC_BUTTON_RINGTONE_BROWSE, OnButtonRingtoneBrowse) 
	ON_BN_CLICKED(IDC_BUTTON_LOGO_FILE_BROWSE, OnButtonLogoFileBrowse) 
	ON_BN_CLICKED(IDC_BUTTON_PB_SAVE, OnButtonPbSave) 
	ON_BN_CLICKED(IDC_BUTTON_SMS_SEND, OnButtonSmsSend) 
	ON_BN_CLICKED(IDC_BUTTON_SMS_SAVE, OnButtonSmsSave) 
	ON_BN_CLICKED(IDC_BUTTON_SMS_RESET, OnButtonSmsReset) 
	ON_BN_CLICKED(IDC_BUTTON_DLGCALL, OnButtonDlgcall) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMobileSMSDemoDlg message handlers 
 
BOOL CMobileSMSDemoDlg::OnInitDialog() 
{ 
	CDialog::OnInitDialog(); 
 
	// Add "About..." menu item to system menu. 
 
	// IDM_ABOUTBOX must be in the system command range. 
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); 
	ASSERT(IDM_ABOUTBOX < 0xF000); 
 
	CMenu* pSysMenu = GetSystemMenu(FALSE); 
	if (pSysMenu != NULL) 
	{ 
		CString strAboutMenu; 
		strAboutMenu.LoadString(IDS_ABOUTBOX); 
		if (!strAboutMenu.IsEmpty()) 
		{ 
			pSysMenu->AppendMenu(MF_SEPARATOR); 
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); 
		} 
	} 
 
	// Set the icon for this dialog.  The framework does this automatically 
	//  when the application's main window is not a dialog 
	SetIcon(m_hIcon, TRUE);			// Set big icon 
	SetIcon(m_hIcon, FALSE);		// Set small icon 
	 
	// TODO: Add extra initialization here 
	m_DlgCall.m_pSMS=&m_SMS; 
	return TRUE;  // return TRUE  unless you set the focus to a control 
} 
 
void CMobileSMSDemoDlg::OnSysCommand(UINT nID, LPARAM lParam) 
{ 
	if ((nID & 0xFFF0) == IDM_ABOUTBOX) 
	{ 
		CAboutDlg dlgAbout; 
		dlgAbout.DoModal(); 
	} 
	else 
	{ 
		CDialog::OnSysCommand(nID, lParam); 
	} 
} 
 
// If you add a minimize button to your dialog, you will need the code below 
//  to draw the icon.  For MFC applications using the document/view model, 
//  this is automatically done for you by the framework. 
 
void CMobileSMSDemoDlg::OnPaint()  
{ 
	if (IsIconic()) 
	{ 
		CPaintDC dc(this); // device context for painting 
 
		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); 
 
		// Center icon in client rectangle 
		int cxIcon = GetSystemMetrics(SM_CXICON); 
		int cyIcon = GetSystemMetrics(SM_CYICON); 
		CRect rect; 
		GetClientRect(&rect); 
		int x = (rect.Width() - cxIcon + 1) / 2; 
		int y = (rect.Height() - cyIcon + 1) / 2; 
 
		// Draw the icon 
		dc.DrawIcon(x, y, m_hIcon); 
	} 
	else 
	{ 
		CDialog::OnPaint(); 
	} 
} 
 
// The system calls this to obtain the cursor to display while the user drags 
//  the minimized window. 
HCURSOR CMobileSMSDemoDlg::OnQueryDragIcon() 
{ 
	return (HCURSOR) m_hIcon; 
} 
 
BEGIN_EVENTSINK_MAP(CMobileSMSDemoDlg, CDialog) 
    //{{AFX_EVENTSINK_MAP(CMobileSMSDemoDlg) 
	ON_EVENT(CMobileSMSDemoDlg, IDC_MOBILESMSCTRL, 1 /* NewMsg */, OnNewMsgMobilesmsctrl, VTS_I4 VTS_BSTR VTS_BSTR VTS_BSTR VTS_I4) 
	ON_EVENT(CMobileSMSDemoDlg, IDC_MOBILESMSCTRL, 2 /* NewReport */, OnNewReportMobilesmsctrl, VTS_I4 VTS_BSTR VTS_BSTR VTS_I4) 
	ON_EVENT(CMobileSMSDemoDlg, IDC_MOBILESMSCTRL, 3 /* NewIncommingCall */, OnNewIncommingCallMobilesmsctrl, VTS_BSTR) 
	//}}AFX_EVENTSINK_MAP 
END_EVENTSINK_MAP() 
 
void CMobileSMSDemoDlg::OnNewMsgMobilesmsctrl(long Index, LPCTSTR Phone, LPCTSTR Text, LPCTSTR Time, long Code)  
{ 
	// TODO: Add your control notification handler code here 
	CString strTemp; 
	strTemp.Format("New message: %d,%s,%s,%s",Index,Time,Phone,Text); 
	AfxMessageBox(strTemp); 
	OnButtonSmsRefresh(); 
} 
 
void CMobileSMSDemoDlg::OnNewReportMobilesmsctrl(long Index, LPCTSTR Phone, LPCTSTR Time, long Delivery)  
{ 
	// TODO: Add your control notification handler code here 
	CString strTemp; 
	strTemp.Format("New report: %d,%s,%s,%d",Index,Time,Phone,Delivery); 
	AfxMessageBox(strTemp);	 
} 
 
void CMobileSMSDemoDlg::OnNewIncommingCallMobilesmsctrl(LPCTSTR Phone)  
{ 
	// TODO: Add your control notification handler code here 
	m_DlgCall.m_lCallType=1; 
	m_DlgCall.m_strPhone=Phone; 
	m_DlgCall.DoModal(); 
} 
 
void CMobileSMSDemoDlg::OnButtonConnect()  
{ 
	// TODO: Add your control notification handler code here 
	long lBaudrate=9600; 
	UpdateData(TRUE); 
	switch(m_lComBaudrate) 
	{ 
	case 0: lBaudrate=9600;	break; 
	case 1: lBaudrate=19200; break; 
	case 2: lBaudrate=57600; break; 
	case 3: lBaudrate=115200; break; 
	default: break; 
	} 
	m_SMS.SetConnectionMode(m_lConnectionMode); 
	m_SMS.SetComNumber(m_lComPort); 
	m_SMS.SetComBaudrate(lBaudrate); 
	if(m_SMS.Connect()<0) 
		AfxMessageBox("Failed!"); 
	else 
		OnButtonRefreshInfo(); 
} 
 
void CMobileSMSDemoDlg::OnButtonDisconnect()  
{ 
	// TODO: Add your control notification handler code here 
	m_SMS.Disconnect(); 
} 
 
void CMobileSMSDemoDlg::OnButtonRefreshInfo()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	m_strManufacture=m_SMS.GetManufacturer(); 
	m_strModel=m_SMS.GetModel(); 
	m_strIMEI=m_SMS.GetIMEI(); 
	m_strNetInfo=m_SMS.GetNetInfo(); 
	m_lBattery=m_SMS.GetBatteryLevel(); 
	m_lSignal=m_SMS.GetSignalLevel(); 
	m_strVersion=m_SMS.GetVersion(); 
	m_strTime=m_SMS.GetTime(); 
 
	m_lSMSMCC=m_SMS.GetMobileMCC(); 
	m_lSMSMNC=m_SMS.GetMobileMNC(); 
 
	UpdateData(FALSE); 
	OnButtonGetSmsc(); 
} 
 
void CMobileSMSDemoDlg::OnButtonSetTime()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	if(m_SMS.SetTime(m_strTime)<0) 
		AfxMessageBox("Failed!"); 
	else 
		AfxMessageBox("Successful!"); 
} 
 
void CMobileSMSDemoDlg::OnButtonSmsRefresh()  
{ 
	// TODO: Add your control notification handler code here 
	CString strTemp; 
	UpdateData(TRUE); 
	m_strSMSResult.Empty(); 
	UpdateData(FALSE); 
	long lCapability=m_SMS.SMSGetCapability(); 
	if(lCapability>20) 
		lCapability=20; 
	long lCount=m_SMS.SMSGetCount(); 
	long lReaded=0; 
	for(int i=0;i0) 
			{ 
				strTemp+=m_SMS.GetSMSLastReadTime()+"    "; 
				strTemp+=m_SMS.GetSMSLastReadPhone()+"    "; 
				strTemp+=m_SMS.GetSMSLastReadText(); 
				lReaded++; 
			} 
		} 
		m_strSMSResult+=strTemp+"\r\n"; 
		UpdateData(FALSE); 
	} 
} 
 
void CMobileSMSDemoDlg::OnButtonPbRefresh()  
{ 
	// TODO: Add your control notification handler code here 
	CString strTemp; 
	UpdateData(TRUE); 
	m_strPBResult.Empty(); 
	UpdateData(FALSE); 
	for(int j=0;j<5;j++) 
	{ 
		switch(j) 
		{ 
		case 0: strTemp="MC"; m_strPBResult+="<<<<<<<<<<>>>>>>>\r\n"; break; 
		case 1: strTemp="LD"; m_strPBResult+="<<<<<<<<<<>>>>>>\r\n"; break; 
		case 2: strTemp="RC"; m_strPBResult+="<<<<<<<<>>>>>>>\r\n"; break; 
		case 3: strTemp="SM"; m_strPBResult+="<<<<<<<<<<<<<>>>>>>>>>>>>\r\n"; break; 
		case 4: strTemp="ME"; m_strPBResult+="<<<<<<<<<<<<>>>>>>>>>>>\r\n"; break; 
		default: break; 
		} 
		if(m_SMS.PBSetStorage(strTemp)<0) 
			continue; 
		long lCapability=m_SMS.PBGetCapability(); 
		if(lCapability>10) 
			lCapability=10; 
		long lCount=m_SMS.PBGetCount(); 
		long lReaded=0; 
		for(int i=0;i0) 
				{ 
					strTemp+=m_SMS.GetPBLastReadPhone()+"    "; 
					strTemp+=m_SMS.GetPBLastReadName(); 
					lReaded++; 
				} 
			} 
			m_strPBResult+=strTemp; 
			m_strPBResult+="\r\n"; 
			UpdateData(FALSE); 
		} 
	} 
} 
 
void CMobileSMSDemoDlg::OnButtonGetSmsc()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	m_strSMSSMSC=m_SMS.GetSMSCNumber(); 
	UpdateData(FALSE); 
} 
 
void CMobileSMSDemoDlg::OnButtonSetSmsc()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	if(m_SMS.SetSMSCNumber(m_strSMSSMSC)<0) 
		AfxMessageBox("Failed!"); 
	else 
		AfxMessageBox("Successful!"); 
} 
 
void CMobileSMSDemoDlg::OnButtonPbDelete()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	m_SMS.PBSetStorage("SM");	//SIM card 
	if(m_SMS.PBDelete(m_lPBIndex)<0) 
		AfxMessageBox("Failed!"); 
	else 
		AfxMessageBox("Successful!"); 
} 
 
void CMobileSMSDemoDlg::OnButtonSmsDelete()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	if(m_SMS.SMSDelete(m_lSMSIndex)<0) 
		AfxMessageBox("Failed!"); 
	else 
		OnButtonSmsRefresh(); 
} 
 
void CMobileSMSDemoDlg::OnButtonRingtoneBrowse()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	CFileDialog dlgFileOpen(TRUE); 
 
	/* 
	if ((DWORD)(LOBYTE(LOWORD(GetVersion()))) < 0x80000000)	//Windows 2000 style 
		dlgFileOpen.m_ofn.lStructSize=88; 
	*/ 
	if(dlgFileOpen.DoModal()!=IDOK) 
		return; 
	m_strSMSRingtone=dlgFileOpen.m_ofn.lpstrFile; 
	UpdateData(FALSE); 
} 
 
void CMobileSMSDemoDlg::OnButtonLogoFileBrowse()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	CFileDialog dlgFileOpen(TRUE); 
 
	/* 
	if ((DWORD)(LOBYTE(LOWORD(GetVersion()))) < 0x80000000)	//Windows 2000 style 
		dlgFileOpen.m_ofn.lStructSize=88; 
	*/ 
	if(dlgFileOpen.DoModal()!=IDOK) 
		return; 
	m_strSMSLogoFile=dlgFileOpen.m_ofn.lpstrFile; 
	UpdateData(FALSE); 
} 
 
void CMobileSMSDemoDlg::OnButtonPbSave()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(TRUE); 
	m_SMS.PBSetStorage("SM");	//SIM card 
	if(m_SMS.PBSave(m_lPBIndex,m_strPBPhone,m_strPBName)<0) 
		AfxMessageBox("Failed!"); 
	else 
		AfxMessageBox("Successful!"); 
} 
 
void CMobileSMSDemoDlg::OnButtonSmsSend()  
{ 
	// TODO: Add your control notification handler code here 
	long lCode=0,lResult; 
	UpdateData(TRUE); 
 
	m_SMS.SetSMSSendNeedReport(m_bSMSNeedReport); 
	m_SMS.SetSMSSendValidity(m_lSMSValidity); 
	m_SMS.SetMobileMCC(m_lSMSMCC);	//Nokia only 
	m_SMS.SetMobileMNC(m_lSMSMNC);	//Nokia only 
 
	switch(m_lOptType) 
	{ 
	case 0:  lCode=1;		break;	//TEXT MESSAGE 
	case 1:  lCode=2;		break;	//LONG TEXT MESSAGE 
	case 2:  lCode=3;		break;	//AUTOSHOW TEXT MESSAGE 
	case 3:  lCode=4;		break;	//FLASH TEXT MESSAGE 
 
	case 5:  lCode=2001;	break;	//NOKIA RINGTONE 
	case 6:  lCode=2011;	break;	//SIEMENS RINGTONE 
	case 7:  lCode=2021;	break;	//ALCATEL RINGTONE 
	case 8:  lCode=2031;	break;	//MOTOROLA RINGTONE 
	case 9:  lCode=2041;	break;	//EMS RINGTONE 
	case 10: lCode=2051;	break;	//SAMSUNG RINGTONE 
 
	case 12: lCode=1001;	break;	//NOKIA CLI LOGO 
	case 13: lCode=1002;	break;	//NOKIA OPERATOR LOGO 
	case 14: lCode=1004;	break;	//NOKIA PICTURE 
	case 15: lCode=1011;	break;	//SIEMENS LOGO 
	case 16: lCode=1021;	break;	//ALCATEL LOGO 
	case 17: lCode=1031;	break;	//MOTOROLA LOGO 
	case 18: lCode=1041;	break;	//EMS LOGO 
	case 19: lCode=1051;	break;	//SAMSUNG LOGO 
	default: break; 
	} 
	if(lCode>2000)		//Ringtone 
		lResult=m_SMS.RingtoneSend(m_strSMSPhone,m_strSMSRingtone,lCode); 
	else if(lCode>1000)	//Logo 
		lResult=m_SMS.LogoSend(m_strSMSPhone,m_strSMSLogoFile,lCode); 
	else				//Text 
		lResult=m_SMS.SMSSend(m_strSMSPhone,m_strSMSText,lCode); 
	if(lResult<0) 
		AfxMessageBox("Failed!"); 
	else 
		AfxMessageBox("Successful!"); 
} 
 
void CMobileSMSDemoDlg::OnButtonSmsSave()  
{ 
	// TODO: Add your control notification handler code here 
	long lCode=0,lResult; 
	UpdateData(TRUE); 
 
	m_SMS.SetSMSSendNeedReport(m_bSMSNeedReport); 
	m_SMS.SetSMSSendValidity(m_lSMSValidity); 
	m_SMS.SetMobileMCC(m_lSMSMCC);	//Nokia only 
	m_SMS.SetMobileMNC(m_lSMSMNC);	//Nokia only 
 
	switch(m_lOptType) 
	{ 
	case 0:  lCode=1;		break;	//TEXT MESSAGE 
	case 1:  lCode=2;		break;	//LONG TEXT MESSAGE 
	case 2:  lCode=3;		break;	//AUTOSHOW TEXT MESSAGE 
	case 3:  lCode=4;		break;	//FLASH TEXT MESSAGE 
 
	case 4:  lCode=2001;	break;	//NOKIA RINGTONE 
	case 5:  lCode=2011;	break;	//SIEMENS RINGTONE 
	case 6:  lCode=2021;	break;	//ALCATEL RINGTONE 
	case 7:  lCode=2031;	break;	//MOTOROLA RINGTONE 
	case 8:  lCode=2041;	break;	//EMS RINGTONE 
	case 9:  lCode=2051;	break;	//SAMSUNG RINGTONE 
 
	case 10: lCode=1001;	break;	//NOKIA CLI LOGO 
	case 11: lCode=1002;	break;	//NOKIA OPERATOR LOGO 
	case 12: lCode=1004;	break;	//NOKIA PICTURE 
	case 13: lCode=1011;	break;	//SIEMENS LOGO 
	case 14: lCode=1021;	break;	//ALCATEL LOGO 
	case 15: lCode=1031;	break;	//MOTOROLA LOGO 
	case 16: lCode=1041;	break;	//EMS LOGO 
	case 17: lCode=1051;	break;	//SAMSUNG LOGO 
	default: break; 
	} 
	if(lCode>2000)		//Ringtone 
		lResult=m_SMS.RingtoneSave(m_strSMSRingtone,lCode,0); 
	else if(lCode>1000)	//Logo 
		lResult=m_SMS.LogoSave(m_strSMSLogoFile,lCode); 
	else				//Text 
		lResult=m_SMS.SMSSave(m_strSMSPhone,m_strSMSText,lCode); 
	if(lResult<0) 
		AfxMessageBox("Failed!"); 
	else 
		AfxMessageBox("Successful!"); 
} 
 
void CMobileSMSDemoDlg::OnButtonSmsReset()  
{ 
	// TODO: Add your control notification handler code here 
	long lCode=0,lResult=-1; 
	UpdateData(TRUE); 
	switch(m_lOptType)		//Logo only 
	{ 
	case 10: lCode=1001;	break;	//NOKIA CLI LOGO 
	case 11: lCode=1002;	break;	//NOKIA OPERATOR LOGO 
	case 12: lCode=1004;	break;	//NOKIA PICTURE 
	case 13: lCode=1011;	break;	//SIEMENS LOGO 
	case 14: lCode=1021;	break;	//ALCATEL LOGO 
	case 15: lCode=1031;	break;	//MOTOROLA LOGO 
	case 16: lCode=1041;	break;	//EMS LOGO 
	case 17: lCode=1051;	break;	//SAMSUNG LOGO 
	default: break; 
	} 
	if(lCode<2000&&lCode>1000)	//Logo 
		lResult=m_SMS.LogoReset(lCode); 
	if(lResult<0) 
		AfxMessageBox("Failed!"); 
	else 
		AfxMessageBox("Successful!"); 
} 
 
void CMobileSMSDemoDlg::OnButtonDlgcall()  
{ 
	// TODO: Add your control notification handler code here 
	m_DlgCall.m_lCallType=0; 
	m_DlgCall.DoModal(); 
}