// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "EmailUse.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_HOME, OnHome)
ON_COMMAND(ID_NEW, OnNew)
ON_COMMAND(ID_GET, OnGet)
ON_COMMAND(ID_DEL, OnDel)
ON_COMMAND(ID_ADDR, OnAddr)
ON_COMMAND(ID_RETURN, OnReturn)
ON_COMMAND(ID_TURN, OnTurn)
ON_COMMAND(ID_NEWUSER, OnNewuser)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
m_Imagelist.Create(32,32,ILC_COLOR24|ILC_MASK,0,1);
m_Imagelist.Add(AfxGetApp()->LoadIcon(IDI_ICON_HOME));
m_Imagelist.Add(AfxGetApp()->LoadIcon(IDI_ICON_GET));
m_Imagelist.Add(AfxGetApp()->LoadIcon(IDI_ICON_NEW));
m_Imagelist.Add(AfxGetApp()->LoadIcon(IDI_ICON_BACK));
m_Imagelist.Add(AfxGetApp()->LoadIcon(IDI_ICON_TURN));
m_Imagelist.Add(AfxGetApp()->LoadIcon(IDI_ICON_DEL));
m_Imagelist.Add(AfxGetApp()->LoadIcon(IDI_ICON_ADDR));
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_TOOLBAR1))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
m_wndToolBar.GetToolBarCtrl().SetImageList(&m_Imagelist);
m_wndToolBar.GetToolBarCtrl().SetButtonSize(CSize(48,48));
m_wndToolBar.GetToolBarCtrl().SetBitmapSize(CSize(32,32));
m_wndToolBar.SetButtonText(0,"选项");
m_wndToolBar.SetButtonText(1,"收取");
m_wndToolBar.SetButtonText(3,"撰写");
m_wndToolBar.SetButtonText(4,"回复");
m_wndToolBar.SetButtonText(5,"转发");
m_wndToolBar.SetButtonText(7,"删除");
m_wndToolBar.SetButtonText(8,"地址簿");
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnHome()
{
// TODO: Add your command handler code here
/* CPOP3 pop3((m_leftView->_pop3).c_str());
pop3.SetUserProperties((m_leftView->_user).c_str(),(m_leftView->_pass).c_str());
if(!pop3.Connect())
{
AfxMessageBox(pop3.GetLastError());
return ;
}
CString out;
if(!pop3.GetUidlMsg(5,out))
{
AfxMessageBox(pop3.GetLastError());
pop3.Disconnect();
return ;
}
if(!pop3.Disconnect())
{
AfxMessageBox(pop3.GetLastError());
return ;
}
AfxMessageBox(out);
*/
CString date=(CTime::GetCurrentTime()).Format("%a,%d %b %Y %H:%M:%S");
date+=" +0800 (CST)";
AfxMessageBox(date);
}
void CMainFrame::OnNew()
{
// TODO: Add your command handler code here
CSendDlgD sendDlg;
sendDlg.leftView=m_leftView;
sendDlg.DoModal();
}
void CMainFrame::OnGet()
{
// TODO: Add your command handler code here
// CProDlg* dlg=new CProDlg;
// dlg->Create(IDD_DIALOG2,GetDesktopWindow());
// dlg->ShowWindow(SW_SHOW);
CSplitterView* splitView=m_leftView->m_pRightFrame->m_pSplitterView;
CListCtrlView* listView=splitView->listView;
listView->flag=0; //标志为收件箱
//设置当前工作的目录
string directory;
directory=".\\mail\\";
directory+=m_leftView->_email.c_str();
//listView->m_listCtrl.SetRedraw(false);
CPOP3 pop3((m_leftView->_pop3).c_str());
pop3.SetUserProperties((m_leftView->_user).c_str(),(m_leftView->_pass).c_str());
if(!pop3.Connect())
{
AfxMessageBox(pop3.GetLastError());
return ;
}
int num=pop3.GetNumMessages();
if(num==-1)
{
AfxMessageBox(pop3.GetLastError());
return ;
}
CString msg;
vector<int> msgnum;
CFileHelp file;
string tmp;
file.Fileread(tmp,directory+"\\uidl");
for(int i=1;i<=num;i++)
{
if(!pop3.GetUidlMsg(i,msg))
{
AfxMessageBox(pop3.GetLastError());
pop3.Disconnect();
return ;
}
int pos1=msg.Find(" ",4);
msg=msg.Mid(pos1+1);
int pos2=msg.Find("\r\n");
msg=msg.Left(pos2);
msg+="&&\r\n";
// AfxMessageBox(msg);
// msg=msg.Mid(msg.Find(" ")+1);
int n=-1;
n=tmp.find((LPSTR)(LPCTSTR)msg);
if(n<0)
{
msgnum.push_back(i);
file.Filewrite((LPSTR)(LPCTSTR)msg,directory+"\\uidl");
}
}
//msgnum.size()
vector<string> Vstr;
for(i=0;i<msgnum.size();i++)
{
if(!pop3.GetMessage(msgnum[i],msg))
{
AfxMessageBox(pop3.GetLastError());
pop3.Disconnect();
return ;
}
string s((LPSTR)(LPCTSTR)msg);
Vstr.push_back(s);
CMsg m_msg;
m_msg.forDecode((LPSTR)(LPCTSTR)msg);
listView->m_CMsg.push_back(m_msg);
}
if(!pop3.Disconnect())
{
AfxMessageBox(pop3.GetLastError());
return ;
}
// delete dlg;
listView->showList();
CDealEmail dealemail;
dealemail.CDealWrite(Vstr,0,directory);
}
void CMainFrame::OnDel()
{
// TODO: Add your command handler code here
}
void CMainFrame::OnAddr()
{
// TODO: Add your command handler code here
}
void CMainFrame::OnReturn()
{
// TODO: Add your command handler code here
CSplitterView* splitView=m_leftView->m_pRightFrame->m_pSplitterView;
CListCtrlView* listView=splitView->listView;
if(listView->m_nRSelItem==-1)
{
AfxMessageBox("请选择一个要转发的邮件");
return ;
}
CSendDlgD sendDlg;
sendDlg.leftView=m_leftView;
sendDlg.EditBox(listView->m_nowMsg);
sendDlg.DoModal();
// sendDlg.m_recer=listView->m_nowMsg._senderAddress;
}
void CMainFrame::OnTurn()
{
// TODO: Add your command handler code here
CSplitterView* splitView=m_leftView->m_pRightFrame->m_pSplitterView;
CListCtrlView* listView=splitView->listView;
if(listView->m_nRSelItem==-1)
{
AfxMessageBox("请选择一个要回复的邮件");
return ;
}
CSendDlgD sendDlg;
sendDlg.leftView=m_leftView;
sendDlg.DoModal();
sendDlg.m_recer=listView->m_nowMsg._senderAddress.c_str();
CString tmp="回复: ";
tmp+=listView->m_nowMsg._subject.c_str();;
sendDlg.m_subject=tmp;
sendDlg.m_content=listView->m_nowMsg._content[0].c_str();
UpdateData(false);
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to create splitter window\n");
return FALSE;
}
// Get the client rect first for calc left pane size
CRect rect;
GetClientRect(&rect);
// create the left tree view first.
if (!m_wndSplitter.CreateView(0, 0, RUNTIM
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
EmailUse.rar (80个子文件)
EmailUse
EmailUse.sln 881B
mail
SendDlg.cpp 1KB
StdAfx.cpp 210B
SplitterView.h 2KB
EmailUse.h 1KB
DealEmail.h 941B
ZQuoted.h 1KB
EmailUse.vcproj 15KB
ZBase64.cpp 3KB
lxDialog.h 1KB
SendMailDlg.cpp 1KB
MyHtmlView.h 2KB
POP3.cpp 5KB
SendDlgD.h 2KB
RightFrame.cpp 1KB
MainFrm.h 2KB
Msg.cpp 8KB
ProDlg.cpp 1KB
ChineseCodeLib.cpp 3KB
FixedSplitter.h 1KB
EmailUseDoc.cpp 2KB
ZSmtp.cpp 7KB
EmailUseView.cpp 2KB
EmailUse.plg 2KB
FileHelp.h 1KB
ProDlg.h 1KB
EmailUse.rc 15KB
SendDlgD.cpp 6KB
ZSmtp.h 2KB
user
user.dat 0B
SplitterView.cpp 3KB
DealEmail.cpp 2KB
ZString.h 1KB
StdAfx.h 1KB
ListCtrlView.cpp 5KB
SendDlg.h 1KB
EmailUse.vcproj.20081219-1835.miyou.user 1KB
EmailUse.dsp 8KB
ZBase64.h 1KB
RightFrame.h 1KB
MainFrm.cpp 11KB
EmailUseDoc.h 1KB
FileListView.h 2KB
UserDlg.cpp 2KB
Resource.h 2KB
FileListView.cpp 3KB
UserDlg.h 1KB
ChineseCodeLib.h 963B
FixedSplitter.cpp 1KB
MyHtmlView.cpp 3KB
res
fasong.ico 346KB
EmailUse.ico 1KB
html1.htm 72B
EmailUseDoc.ico 1KB
Man-Brown.ico 360KB
owl.ico 14KB
home.ico 91KB
trash.ico 94KB
snitch.ico 14KB
toolbar2.bmp 358B
Msn-Butterfly.ico 66KB
Thumbs.db 6KB
toolbar1.bmp 958B
Toolbar.bmp 1KB
EmailUse.rc2 400B
mail.ico 157KB
Finder.ico 82KB
lxDialog.cpp 5KB
EmailUse.suo 11KB
EmailUse.cpp 4KB
ListCtrlView.h 2KB
LeftView.cpp 5KB
EmailUse.dsw 539B
POP3.h 2KB
ZString.cpp 2KB
SendMailDlg.h 1KB
LeftView.h 2KB
FileHelp.cpp 3KB
Msg.h 1KB
EmailUseView.h 2KB
共 80 条
- 1
资源评论
- pwoolong2013-12-17很好参考,谢谢分享
- mayipaobu2014-05-08东西很好啊,代码比较复杂,我要好好琢磨,谢谢啊
- givay20102014-03-28东西很好我很喜欢!
- flamkuavos2012-06-09代码蛮复杂,不好屡清楚
- czmxbb522014-12-14垃圾,VS2008编译根本通不过,还特复杂
you_5050
- 粉丝: 13
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 技术面试最后反问面试官的话 校招面试非技术问题有哪些 非技术问题如何回答.png
- NB-IOT-BC26全网通模块Altium+ CADENCE +PADS三种格式(原理图SCH+PCB封装库)文件.zip
- 基于微信小程序开发的校园失物招领系统源码毕业设计(优质项目源码).zip
- 词向量是一种将自然语言中的单词转换为数值向量的技术,它能够捕捉词义和上下文信息
- nmap与masscan的简单使用
- MyBatis动态SQL.pdf
- 基于stm32单片机protues仿真的温湿度控制系统设计(仿真图、源代码)
- 词向量:自然语言处理的基石
- mybatis动态sql
- 40G微信小程序开发教程(工具插件+视频教程)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功