📄 cmailimfdlg.cpp
字号:
// CMailImfDlg.cpp: implementation of the CMailImfDlg class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "CMailImfDlg.h"
#include "resource.h"
#include "MailInfoDB.h"
#include "harTransform.h"
#include "CMailSource.h"
CMailImfDlg g_cmailimfdlg;
extern HINSTANCE g_hInst;
extern CeMailDate g_maildate;
extern CMailSource g_mailsourcedlg;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMailImfDlg::CMailImfDlg()
{
}
CMailImfDlg::~CMailImfDlg()
{
}
BOOL CALLBACK CMailImfDlgProc(const HWND hDlg, const UINT uiMessage, const WPARAM wParam, const LPARAM lParam)
{
BOOL bProcessedMsg = TRUE;
switch(uiMessage)
{
case WM_INITDIALOG:
CMailImfDlg::InitialDlg(g_cmailimfdlg,hDlg);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case ID_MENUITEM_OK:
CMailImfDlg::DestroyDlg(g_cmailimfdlg,hDlg);
break;
case ID_MENUITEM_VS:
g_mailsourcedlg.m_filename = g_cmailimfdlg.m_prmail->m_Filename;
CMailSource::DlgBox(g_mailsourcedlg,g_hInst,hDlg);
break;
default:
bProcessedMsg = FALSE;
break;
}
break;
case WM_CLOSE:
CMailImfDlg::DestroyDlg(g_cmailimfdlg,hDlg);
break;
case WM_HOTKEY:
if(VK_TBACK == HIWORD(lParam))
{
}
else
bProcessedMsg = FALSE;
break;
case WM_ACTIVATE:
{
DWORD dwFlags = LOWORD(wParam);
if(dwFlags != WA_INACTIVE)
{
SetFocus(GetDlgItem(hDlg,IDC_EDIT_CONTENT));
}
else
{
bProcessedMsg = FALSE;
}
break;
}
default:
bProcessedMsg = FALSE;
break;
}
return bProcessedMsg;
}
BOOL CMailImfDlg::DlgBox(CMailImfDlg &dlg, HINSTANCE hinstance, HWND parent)
{
dlg.m_result = DialogBox(hinstance,MAKEINTRESOURCE(IDD_DIALOG_MAILIMF),parent,(DLGPROC)CMailImfDlgProc);
if(dlg.m_result == -1)
return FALSE;
return TRUE;
}
BOOL CMailImfDlg::InitialDlg(CMailImfDlg &dlg, HWND hDlg)
{
TCHAR lpszSubTitle[32];
// Specify that the dialog box should stretch full screen
SHINITDLGINFO shidi;
ZeroMemory(&shidi, sizeof(shidi));
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN|SHIDIF_SIPDOWN;
shidi.hDlg = hDlg;
// Set up the menu bar
SHMENUBARINFO shmbi;
ZeroMemory(&shmbi, sizeof(shmbi));
shmbi.cbSize = sizeof(shmbi);
shmbi.hwndParent = hDlg;
shmbi.nToolBarId = IDR_MENUBAR_RMAILIMF;
shmbi.hInstRes = g_hInst;
// If we could not initialize the dialog box, return an error
if (!(SHInitDialog(&shidi) && SHCreateMenuBar(&shmbi)))
{
return FALSE;
}
// set the title bar
LoadString(g_hInst,IDS_STRING_MAILCONTENT,lpszSubTitle,ARRAYSIZE(lpszSubTitle));
if (lpszSubTitle)
SetWindowText(hDlg, lpszSubTitle);
//Overriding Back button functionality
(void)SendMessage(shmbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK,
MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY,
SHMBOF_NODEFAULT | SHMBOF_NOTIFY));
SendMessage(GetDlgItem(hDlg,IDC_EDIT_CONTENT),EM_LIMITTEXT,MAIL_CONTENTLENTH,0);
CMail *pmail = new CMail;
CharTransform trans;
g_maildate.GetMailDetails(dlg.m_prmail->m_Filename,*pmail);
TCHAR* pcontent = trans.CharToTChar(pmail->m_textplain);
SetWindowText(GetDlgItem(hDlg,IDC_EDIT_CONTENT),pcontent);
SetWindowText(GetDlgItem(hDlg,IDC_EDIT_FROM),dlg.m_prmail->m_From);
SetWindowText(GetDlgItem(hDlg,IDC_EDIT_SUBJECT),dlg.m_prmail->m_Subject);
if(pmail!= NULL)
delete pmail;
delete []pcontent;
return TRUE;
}
BOOL CMailImfDlg::DestroyDlg(CMailImfDlg &dlg, HWND hDlg)
{
if(!EndDialog(hDlg,dlg.m_result))
return FALSE;
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -