【VC开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VC开源代码-GsmGprsView.cpp的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
// GsmGprsView.cpp : implementation of the CGsmGprsView class
//
#include "stdafx.h"
#include "GsmGprs.h"
#include "GsmGprsDoc.h"
#include "GsmGprsView.h"
///////////////////////////////////////
#include "sms.h"
extern CGsmGprsApp theApp;
///////////////////////////////////////
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGsmGprsView
IMPLEMENT_DYNCREATE(CGsmGprsView, CFormView)
BEGIN_MESSAGE_MAP(CGsmGprsView, CFormView)
//{{AFX_MSG_MAP(CGsmGprsView)
ON_BN_CLICKED(IDC_BUTTON_SEND, OnButtonSend)
ON_BN_CLICKED(IDC_BUTTON_INITGPRS, OnButtonInitgprs)
ON_BN_CLICKED(IDC_BUTTON_OPENGPRS, OnButtonOpengprs)
ON_BN_CLICKED(IDC_BUTTON_WRITEGPRS, OnButtonWritegprs)
ON_BN_CLICKED(IDC_BUTTON_READGPRS, OnButtonReadgprs)
ON_WM_TIMER()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGsmGprsView construction/destruction
CGsmGprsView::CGsmGprsView()
: CFormView(CGsmGprsView::IDD)
{
//{{AFX_DATA_INIT(CGsmGprsView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// TODO: add construction code here
}
CGsmGprsView::~CGsmGprsView()
{
}
void CGsmGprsView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGsmGprsView)
DDX_Control(pDX, IDC_SMS_LIST, m_ListCtrl);
//}}AFX_DATA_MAP
}
BOOL CGsmGprsView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
void CGsmGprsView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
///////////////////////////////////////////////////////////
m_ListCtrl.SetBkColor(RGB(196,220,232));
m_ListCtrl.SetTextBkColor(RGB(196,220,232));
m_ListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
m_ListCtrl.InsertColumn(0,_T("号码"),LVCFMT_IMAGE|LVCFMT_LEFT);
m_ListCtrl.InsertColumn(1,_T("时间"));
m_ListCtrl.InsertColumn(2,_T("消息内容"));
m_ListCtrl.SetColumnWidth(0,100);
m_ListCtrl.SetColumnWidth(1,150);
m_ListCtrl.SetColumnWidth(2,360);
SetTimer(1, 1000, NULL);
///////////////////////////////////////////////////////////
}
/////////////////////////////////////////////////////////////////////////////
// CGsmGprsView printing
BOOL CGsmGprsView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CGsmGprsView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CGsmGprsView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
void CGsmGprsView::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/)
{
// TODO: add customized printing code here
}
/////////////////////////////////////////////////////////////////////////////
// CGsmGprsView diagnostics
#ifdef _DEBUG
void CGsmGprsView::AssertValid() const
{
CFormView::AssertValid();
}
void CGsmGprsView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CGsmGprsDoc* CGsmGprsView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CGsmGprsDoc)));
return (CGsmGprsDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CGsmGprsView message handlers
void CGsmGprsView::OnButtonSend()
{
// TODO: Add your control notification handler code here
// 发送短信
CComboBox* pNumberWnd=(CComboBox*)GetDlgItem(IDC_NUMBER);
CComboBox* pContentWnd=(CComboBox*)GetDlgItem(IDC_CONTENT);
CString strSmsc;
CString strNumber;
CString strContent;
strSmsc = theApp.m_strSmsc;
pNumberWn