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

📄 smssetview.cpp

📁 对Motorola的手机模块
💻 CPP
字号:
// SmsSetView.cpp : implementation file
//

#include "stdafx.h"
#include "smsinterface.h"
#include "SmsSetView.h"
#include "SerialPort.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSmsSetView

IMPLEMENT_DYNCREATE(CSmsSetView, CFormView)

CSmsSetView::CSmsSetView()
	: CFormView(CSmsSetView::IDD)
{
	//{{AFX_DATA_INIT(CSmsSetView)
	m_servernostr = _T("");
	//}}AFX_DATA_INIT
	isoperating=FALSE;
}

CSmsSetView::~CSmsSetView()
{
}

void CSmsSetView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSmsSetView)
	DDX_Control(pDX, IDC_BUTTON_SET, m_btnset);
	DDX_Text(pDX, IDC_EDIT_SERVERNO, m_servernostr);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSmsSetView, CFormView)
	//{{AFX_MSG_MAP(CSmsSetView)
	ON_BN_CLICKED(IDC_BUTTON_SET, OnButtonSet)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSmsSetView diagnostics

#ifdef _DEBUG
void CSmsSetView::AssertValid() const
{
	CFormView::AssertValid();
}

void CSmsSetView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

CSmsinterfaceDoc* CSmsSetView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSmsinterfaceDoc)));
	return (CSmsinterfaceDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CSmsSetView message handlers

void CSmsSetView::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();
	// TODO: Add your specialized code here and/or call the base class
	
}

BOOL CSmsSetView::PreCreateWindow(CREATESTRUCT& cs) 
{
	// TODO: Add your specialized code here and/or call the base class
	
	return CFormView::PreCreateWindow(cs);
}

void CSmsSetView::OnButtonSet() 
{
	// TODO: Add your control notification handler code here
	if(isoperating)
	{
		UpdateData();
		CEdit* editwnd;
		editwnd=(CEdit*)this->GetDlgItem(IDC_EDIT_SERVERNO);
		::EnableWindow(editwnd->m_hWnd,!isoperating);
		m_btnset.SetWindowText("修      改");
		isoperating=FALSE;
		int len,i;
		serverphonestr=m_servernostr;
		len=serverphonestr.GetLength();
		i=0;
		while(i<len)
		{
			serverno[i]=serverphonestr.GetAt(i);
			i++;
		}
		CFrameWnd* pframe;
		pframe=this->GetParentFrame();
		pframe->PostMessage(WM_REQUEST_GETSERVERPHONE,(WPARAM)i,(LPARAM)&serverno);
	}
	else
	{
		CEdit* editwnd;
		editwnd=(CEdit*)this->GetDlgItem(IDC_EDIT_SERVERNO);
		::EnableWindow(editwnd->m_hWnd,!isoperating);
		m_btnset.SetWindowText("保存设置");
		isoperating=TRUE;

	}
}

LRESULT CSmsSetView::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(message==WM_SENDSERVERPHONE)
	{
		GetServerPhone((int)wParam,(char *)lParam);
	}
	return CFormView::DefWindowProc(message, wParam, lParam);
}

void CSmsSetView::GetServerPhone(int nSize, char serverphone[])
{
	int i=0;
	serverphonestr.Empty();
	while(i<nSize)
	{
		serverphonestr.Insert(nSize+1,serverphone[i]);
		i++;
	}
	m_servernostr=serverphonestr;
	CEdit* editwnd;
	editwnd=(CEdit*)this->GetDlgItem(IDC_EDIT_SERVERNO);
	::EnableWindow(editwnd->m_hWnd,FALSE);
	isoperating=FALSE;
	UpdateData(FALSE);
}


⌨️ 快捷键说明

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