📄 sended.cpp
字号:
// Sended.cpp : implementation file
//
#include "stdafx.h"
#include "Send.h"
#include "Sended.h"
#include "SendDb.h"
#include "user.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSended dialog
CSended::CSended(CWnd* pParent /*=NULL*/)
: CDialog(CSended::IDD, pParent)
{
//{{AFX_DATA_INIT(CSended)
m_Date = 0;
m_Time = 0;
m_Phone = _T("");
m_Content = _T("");
//}}AFX_DATA_INIT
}
void CSended::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSended)
DDX_Control(pDX, IDC_LIST1, m_ListBx);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_Date);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER2, m_Time);
DDX_Text(pDX, IDC_EDIT1, m_Phone);
DDX_Text(pDX, IDC_EDIT4, m_Content);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSended, CDialog)
//{{AFX_MSG_MAP(CSended)
ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSended message handlers
BOOL CSended::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
int nIndex;
CDatabase db;
CSendDb *pSendSet=NULL;
if(db.Open("SendMessage"))
{
pSendSet=new CSendDb();
pSendSet->Open();
while(!pSendSet->IsEOF())
{
if(pSendSet->m_isSend)
{
CUser *pUser=new CUser();
pUser->Phone=pSendSet->m_Phone;
pUser->Content=pSendSet->m_Content;
pUser->Time=pSendSet->m_Time;
pUser->ID=pSendSet->m_ID;
nIndex=m_ListBx.AddString(pSendSet->m_Phone);
m_ListBx.SetItemDataPtr(nIndex,pUser);
}
pSendSet->MoveNext();
}
pSendSet->Close();
delete pSendSet;
db.Close();
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSended::OnSelchangeList1()
{
int nIndex=m_ListBx.GetCurSel();
if(nIndex!=LB_ERR)
{
CUser *pUser=(CUser *)m_ListBx.GetItemDataPtr(nIndex);
m_Content=pUser->Content;
m_Date=pUser->Time;
m_Time=pUser->Time;
m_Phone=pUser->Phone;
UpdateData(FALSE);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -