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


// ToolDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Fax_Event_VC.h" 
#include "ToolDlg.h" 
#include "../../../../api/vc6.0/inc/BmpApi.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CToolDlg dialog 
 
 
CToolDlg::CToolDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CToolDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CToolDlg) 
	m_nFromX = 0; 
	m_nFromY = 0; 
	m_nRow = 0; 
	m_nSubX = 0; 
	m_nSubY = 0; 
	m_nTimeX = 0; 
	m_nTimeY = 0; 
	m_nToY = 0; 
	m_nToX = 0; 
	m_strPathFile = _T(""); 
	m_szFrom = _T(""); 
	m_szSub = _T(""); 
	m_szTime = _T(""); 
	m_szTo = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CToolDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CToolDlg) 
	DDX_Text(pDX, IDC_EDIT_nFromX, m_nFromX); 
	DDX_Text(pDX, IDC_EDIT_nFromY, m_nFromY); 
	DDX_Text(pDX, IDC_EDIT_nRow, m_nRow); 
	DDX_Text(pDX, IDC_EDIT_nSubX, m_nSubX); 
	DDX_Text(pDX, IDC_EDIT_nSubY, m_nSubY); 
	DDX_Text(pDX, IDC_EDIT_nTimeX, m_nTimeX); 
	DDX_Text(pDX, IDC_EDIT_nTimeY, m_nTimeY); 
	DDX_Text(pDX, IDC_EDIT_nToY, m_nToY); 
	DDX_Text(pDX, IDC_EDIT_nToX, m_nToX); 
	DDX_Text(pDX, IDC_EDIT_PATH_FILE, m_strPathFile); 
	DDX_Text(pDX, IDC_EDIT_szFrom, m_szFrom); 
	DDX_Text(pDX, IDC_EDIT_szSub, m_szSub); 
	DDX_Text(pDX, IDC_EDIT_szTime, m_szTime); 
	DDX_Text(pDX, IDC_EDIT_szTo, m_szTo); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CToolDlg, CDialog) 
	//{{AFX_MSG_MAP(CToolDlg) 
	ON_BN_CLICKED(IDC_BUTTON_SHOW, OnButtonShow) 
	ON_BN_CLICKED(IDC_BUTTON_fBmp_GetFileAllPage, OnBUTTONfBmpGetFileAllPage) 
	ON_BN_CLICKED(IDC_BUTTON_IDC_BTN_fBmp_SetHeaderFormat, OnBUTTONIDCBTNfBmpSetHeaderFormat) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CToolDlg message handlers 
 
void CToolDlg::OnButtonShow()  
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(); 
	CFileDialog cf(1, NULL, NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Fax File(*.tif)|*.tif|Tiff File(*.tiff)|*.tiff|Fax File(*.fax)|*.fax|All File(*.*)|*.*|",NULL); 
	char szPath[MAX_PATH]; 
	GetCurrentDirectory(MAX_PATH, szPath); 
	cf.m_ofn.lpstrInitialDir = szPath; 
 
	if(cf.DoModal() == IDOK) 
	{ 
		strcpy(m_strPathFile.GetBuffer(MAX_PATH), cf.GetPathName()); 
		UpdateData(FALSE); 
		m_strPathFile.ReleaseBuffer(-1); 
	}	 
} 
 
 
void CToolDlg::OnBUTTONfBmpGetFileAllPage()		//get the number of fax file pages 
{ 
	// TODO: Add your control notification handler code here 
	CString str; 
	UpdateData(); 
	int n = fBmp_GetFileAllPage(m_strPathFile.GetBuffer(m_strPathFile.GetLength())); 
	str.Format("%d", n); 
	SetDlgItemText(IDC_EDIT_SHOW, str); 
} 
 
 
void CToolDlg::OnBUTTONIDCBTNfBmpSetHeaderFormat()	//set header format 
{ 
	// TODO: Add your control notification handler code here 
	UpdateData(); 
	int n = fBmp_SetHeaderFormat(m_nRow, m_nFromX, m_nFromY,m_szFrom.GetBuffer(m_szFrom.GetLength()) ,  
				m_nSubX, m_nSubY, m_szSub.GetBuffer(m_szSub.GetLength()), 
				m_nToX, m_nToY, m_szTo.GetBuffer(m_szTo.GetLength()), 
				m_nTimeX, m_nTimeY, m_szTime.GetBuffer(m_szTime.GetLength())); 
} 
 
BOOL CToolDlg::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 CToolDlg::InitLab() 
{ 
	if(g_dwLanguageConversion == g_dwCHINESE_SIMPLIFIED) 
	{ 
		//Chinese 
		strLab[0].Format("获取传真文件页数"); 
		strLab[1].Format("文件"); 
		strLab[2].Format("浏览"); 
		strLab[3].Format("页数"); 
		strLab[4].Format("页眉设置属性"); 
 
	} 
	else 
	{	//English 
		strLab[0].Format("Get number of pages of fax file");	 
		strLab[1].Format("File"); 
		strLab[2].Format("Browse"); 
		strLab[3].Format("Numbers of page"); 
		strLab[4].Format("Properties of header"); 
	} 
	SetWinTextLab(this, IDC_STATIC_RETRIEVE_PAGE,	strLab[0]); 
	SetWinTextLab(this, IDC_STATIC_TOOL_FILE,		strLab[1]); 
	SetWinTextLab(this, IDC_BUTTON_SHOW,			strLab[2]); 
	SetWinTextLab(this, IDC_STATIC_TOOL_PAGEAMOUNT, strLab[3]); 
	SetWinTextLab(this, IDC_STATIC_HEADER_SETTING,  strLab[4]); 
}