www.pudn.com > Fax_Event_Message.rar > FourthDlg.cpp


// FourthDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Fax_Event_VC.h" 
#include "FourthDlg.h" 
#include "../../../../api/vc6.0/inc/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()); 
		UpdateData(FALSE); 
		m_strSourceFile.ReleaseBuffer(-1); 
	}	 
} 
 
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()); 
		UpdateData(FALSE); 
		m_strTargetFile.ReleaseBuffer(-1); 
	}	 
} 
 
void CFourthDlg::OnButtonCutTifHeader()  
{ 
	// TODO: Add your control notification handler code here 
	char *pSourceFile, *pTargetFile; 
	int nPageNo, nHeight; 
	UpdateData(); 
	pSourceFile = m_strSourceFile.GetBuffer(m_strSourceFile.GetLength()); 
	pTargetFile = m_strTargetFile.GetBuffer(m_strTargetFile.GetLength()); 
	nPageNo     = m_nPageNo; 
	nHeight		= m_nHeight; 
	int n = fBmp_CutTifHeader(pSourceFile, pTargetFile, nHeight, nPageNo, 0); 
	if(n == 1)	MessageBox("ok"); 
	else		MessageBox("Error");	 
} 
 
 
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]); 
}