📄 fourthdlg.cpp
字号:
// FourthDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Fax_Event_VC.h"
#include "FourthDlg.h"
#include "BmpApi.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFourthDlg dialog
CFourthDlg::CFourthDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFourthDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CFourthDlg)
m_nHeight = 16;
m_nPageNo = -1;
m_strSourceFile = _T("");
m_strTargetFile = _T("");
//}}AFX_DATA_INIT
}
void CFourthDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFourthDlg)
DDX_Text(pDX, IDC_EDIT_HEIGHT, m_nHeight);
DDX_Text(pDX, IDC_EDIT_PAGENO, m_nPageNo);
DDX_Text(pDX, IDC_EDIT_SOURCEFILE, m_strSourceFile);
DDX_Text(pDX, IDC_EDIT_TARGETFILE, m_strTargetFile);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFourthDlg, CDialog)
//{{AFX_MSG_MAP(CFourthDlg)
ON_BN_CLICKED(IDC_BUTTON_SOURCEFILE, OnButtonSourcefile)
ON_BN_CLICKED(IDC_BUTTON_TARGETFILE, OnButtonTargetfile)
ON_BN_CLICKED(IDC_BUTTON_CUT_TIF_HEADER, OnButtonCutTifHeader)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFourthDlg message handlers
void CFourthDlg::OnButtonSourcefile()
{
// TODO: Add your control notification handler code here
char szPath[MAX_PATH];
GetCurrentDirectory(MAX_PATH, szPath);
UpdateData();
CFileDialog cf(1, NULL, NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Fax File(*.tif)|*.tif|Tiff File(*.tiff)|*.tiff|All File(*.*)|*.*|",NULL);
cf.m_ofn.lpstrInitialDir = szPath;
if(cf.DoModal() == IDOK)
{
strcpy(m_strSourceFile.GetBuffer(MAX_PATH), cf.GetPathName());
m_strSourceFile.ReleaseBuffer();
UpdateData(FALSE);
}
}
void CFourthDlg::OnButtonTargetfile()
{
// TODO: Add your control notification handler code here
char szPath[MAX_PATH];
GetCurrentDirectory(MAX_PATH, szPath);
UpdateData();
CFileDialog cf(0, NULL, NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Fax File(*.tif)|*.tif|Tiff File(*.tiff)|*.tiff|All File(*.*)|*.*|",NULL);
cf.m_ofn.lpstrInitialDir = szPath;
if(cf.DoModal() == IDOK)
{
strcpy(m_strTargetFile.GetBuffer(MAX_PATH), cf.GetPathName());
m_strTargetFile.ReleaseBuffer();
UpdateData(FALSE);
}
}
void CFourthDlg::OnButtonCutTifHeader()
{
UpdateData();
char errmsg[100];
int n = fBmp_CutTifHeader(m_strSourceFile, m_strTargetFile, m_nHeight, m_nPageNo, 0);
if(n == 1) MessageBox("ok");
else
{
fBmp_GetErrMsg(errmsg);
MessageBox(errmsg);
}
}
BOOL CFourthDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
InitLab();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CFourthDlg::InitLab()
{
if(g_dwLanguageConversion == g_dwCHINESE_SIMPLIFIED)
{
//Chinese
strLab[0].Format("浏览");
strLab[1].Format("浏览");
}
else
{ //English
strLab[0].Format("Browse");
strLab[1].Format("Browse");
}
SetWinTextLab(this, IDC_BUTTON_SOURCEFILE, strLab[0]);
SetWinTextLab(this, IDC_BUTTON_TARGETFILE, strLab[1]);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -