www.pudn.com > smsinterface.rar > SmsSetView.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(iGetParentFrame(); 
		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(iGetDlgItem(IDC_EDIT_SERVERNO); 
	::EnableWindow(editwnd->m_hWnd,FALSE); 
	isoperating=FALSE; 
	UpdateData(FALSE); 
}