www.pudn.com > smsinterface.rar > SmsDelView.cpp
// SmsDelView.cpp : implementation file // #include "stdafx.h" #include "smsinterface.h" #include "SmsDelView.h" #include#ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CSmsDelView IMPLEMENT_DYNCREATE(CSmsDelView, CFormView) CSmsDelView::CSmsDelView() : CFormView(CSmsDelView::IDD) { //{{AFX_DATA_INIT(CSmsDelView) m_phonenum = _T(""); m_zhenwen = _T(""); m_timestr = _T(""); m_typestr = _T(""); m_smindex = _T(""); //}}AFX_DATA_INIT } CSmsDelView::~CSmsDelView() { } void CSmsDelView::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); //{{AFX_DATA_MAP(CSmsDelView) DDX_Control(pDX, IDC_BUTTON_PRE, m_prebtn); DDX_Control(pDX, IDC_BUTTON_NEXT, m_nextbtn); DDX_Control(pDX, IDC_BUTTON_DEL, m_delbtn); DDX_Text(pDX, IDC_STATIC_SM_PHONE, m_phonenum); DDX_Text(pDX, IDC_STATIC_SM_TEXT, m_zhenwen); DDX_Text(pDX, IDC_STATIC_SM_TIME, m_timestr); DDX_Text(pDX, IDC_STATIC_SM_TYPE, m_typestr); DDX_Text(pDX, IDC_STATIC_SM_INDEX, m_smindex); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CSmsDelView, CFormView) //{{AFX_MSG_MAP(CSmsDelView) ON_BN_CLICKED(IDC_BUTTON_DEL, OnDelSM) ON_BN_CLICKED(IDC_BUTTON_NEXT, OnGetNextSM) ON_BN_CLICKED(IDC_BUTTON_PRE, OnGetPreSM) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CSmsDelView diagnostics #ifdef _DEBUG void CSmsDelView::AssertValid() const { CFormView::AssertValid(); } void CSmsDelView::Dump(CDumpContext& dc) const { CFormView::Dump(dc); } CSmsinterfaceDoc* CSmsDelView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CSmsinterfaceDoc))); return (CSmsinterfaceDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CSmsDelView message handlers void CSmsDelView::OnInitialUpdate() { CFormView::OnInitialUpdate(); GetParentFrame()->RecalcLayout(); ResizeParentToFit(); // TODO: Add your specialized code here and/or call the base class } BOOL CSmsDelView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Add your specialized code here and/or call the base class return CFormView::PreCreateWindow(cs); } void CSmsDelView::OnDelSM() { // TODO: Add your control notification handler code here int flag; flag=AfxMessageBox("您确定要删除当前短消息吗?",MB_YESNO); if(flag==IDYES) { CFrameWnd* pframe; pframe=this->GetParentFrame(); pframe->PostMessage(WM_REQUEST_SMSDEL,curindex,0); } } void CSmsDelView::OnGetNextSM() { // TODO: Add your control notification handler code here CFrameWnd* pframe; pframe=this->GetParentFrame(); pframe->PostMessage(WM_REQUEST_SMSTEXT,curindex+1,0); } void CSmsDelView::OnGetPreSM() { // TODO: Add your control notification handler code here CFrameWnd* pframe; pframe=this->GetParentFrame(); pframe->PostMessage(WM_REQUEST_SMSTEXT,curindex-1,0); } LRESULT CSmsDelView::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // TODO: Add your specialized code here and/or call the base class if(message==WM_GETSMTEXT) { GetSMData((int)wParam,(struct recsmdata *)lParam); } return CFormView::DefWindowProc(message, wParam, lParam); } void CSmsDelView::GetSMData(int totalindex, recsmdata *smdata) { UpdateData(TRUE); if(smdata->smindex==1) ::EnableWindow(m_prebtn,FALSE); else ::EnableWindow(m_prebtn,TRUE); if(smdata->smindex==totalindex) ::EnableWindow(m_nextbtn,FALSE); else ::EnableWindow(m_nextbtn,TRUE); if(smdata->readflag) m_typestr=_T("已读消息"); else m_typestr=_T("未读消息"); m_timestr=smdata->timestr; m_phonenum=smdata->senddialnum; m_zhenwen=smdata->smtext; curindex=smdata->smindex; m_smindex.Format("%d",smdata->smindex); UpdateData(FALSE); }