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


// ThirdDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Fax_Event_VC.h" 
#include "ThirdDlg.h" 
#include "../../../../api/vc6.0/inc/BmpApi.h" 
#include "Tooldlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CThirdDlg dialog 
 
 
CThirdDlg::CThirdDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CThirdDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CThirdDlg) 
	m_strTifName = _T(""); 
	m_strTargetFile = _T(""); 
	m_strDataTime = _T(""); 
	m_strFaxFrom = _T(""); 
	m_strFaxTo = _T(""); 
	m_strFaxSubject = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CThirdDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CThirdDlg) 
	DDX_Text(pDX, IDC_EDIT_TIFFILE, m_strTifName); 
	DDX_Text(pDX, IDC_EDIT_TARGETFILE, m_strTargetFile); 
	DDX_Text(pDX, IDC_EDIT_DATATIME, m_strDataTime); 
	DDX_Text(pDX, IDC_EDIT_FAXFROM, m_strFaxFrom); 
	DDX_Text(pDX, IDC_EDIT_FAXTO, m_strFaxTo); 
	DDX_Text(pDX, IDC_EDIT_SUBJECT, m_strFaxSubject); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CThirdDlg, CDialog) 
	//{{AFX_MSG_MAP(CThirdDlg) 
	ON_BN_CLICKED(IDC_BUTTON_PATHSHOW, OnButtonPathshow) 
	ON_BN_CLICKED(IDC_BUTTON_FILESHOW, OnButtonFileshow) 
	ON_BN_CLICKED(IDC_BUTTON_AddTxtToTif, OnBUTTONAddTxtToTif) 
	ON_BN_CLICKED(IDC_BUTTON_TOOL, OnButtonTool) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CThirdDlg message handlers 
 
void CThirdDlg::OnButtonPathshow()  
{ 
	// 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 CThirdDlg::OnButtonFileshow()  
{ 
	// 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_strTifName.GetBuffer(MAX_PATH), cf.GetPathName()); 
		UpdateData(FALSE); 
		m_strTifName.ReleaseBuffer(-1); 
	} 
} 
 
 
//add header to fax file 
void CThirdDlg::OnBUTTONAddTxtToTif()	 
{ 
	// TODO: Add your control notification handler code here 
	char *pTif, *pFaxFrom, *pFaxTo, *pSub, *pData,*pTarget; 
	UpdateData(); 
	pTif = m_strTifName.GetBuffer(m_strTifName.GetLength()); 
	pFaxFrom = m_strFaxFrom.GetBuffer(m_strFaxFrom.GetLength()); 
	pFaxTo = m_strFaxTo.GetBuffer(m_strFaxTo.GetLength()); 
	pSub = m_strFaxSubject.GetBuffer(m_strFaxSubject.GetLength()); 
	pData = m_strDataTime.GetBuffer(m_strDataTime.GetLength()); 
	pTarget = m_strTargetFile.GetBuffer(m_strTargetFile.GetLength()); 
	int n = fBmp_AddTxtToTif(pTif, pFaxFrom, pFaxTo, pSub, pData, pTarget, 0); 
	if(n == 1)	MessageBox("ok"); 
	else		MessageBox("Error"); 
} 
 
 
void CThirdDlg::OnButtonTool()  
{ 
	// TODO: Add your control notification handler code here 
	CToolDlg dlg; 
	dlg.DoModal(); 
} 
 
 
BOOL CThirdDlg::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 CThirdDlg::InitLab() 
{ 
	if(g_dwLanguageConversion == g_dwCHINESE_SIMPLIFIED) 
	{ 
		//Chinese 
		strLab[0].Format("ä¯ÀÀ"); 
		strLab[1].Format("ä¯ÀÀ"); 
		strLab[2].Format("¹¤¾ß´°¿Ú"); 
	} 
	else 
	{	//English 
		strLab[0].Format("Browse");	 
		strLab[1].Format("Browse"); 
		strLab[2].Format("Tool window"); 
	} 
	SetWinTextLab(this, IDC_BUTTON_FILESHOW, strLab[0]); 
	SetWinTextLab(this, IDC_BUTTON_PATHSHOW, strLab[1]); 
	SetWinTextLab(this, IDC_BUTTON_TOOL,     strLab[2]); 
}