www.pudn.com > Fax_Polling.rar > ForthDlg.cpp


// ForthDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "atrkfax.h" 
#include "ForthDlg.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 
 
///////////////////////////////////////////////////////////////////////////// 
// CForthDlg dialog 
 
 
CForthDlg::CForthDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CForthDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CForthDlg) 
	m_strDatatime = _T("2004-19-65"); 
	m_strFaxFrom = _T("China shOKH"); 
	m_strFaxTo = _T("guanliaojieshan"); 
	m_strFaxSubject = _T("987432"); 
	m_strTargetFile = _T("G:\\Ver4.5.0.5_faxheader\\outputall\\B1.tif"); 
	m_strTifName = _T("G:\\Ver4.5.0.5_faxheader\\outputall\\A1.tif"); 
	//}}AFX_DATA_INIT 
} 
 
 
void CForthDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CForthDlg) 
	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); 
	DDX_Text(pDX, IDC_EDIT_TARGETFILE, m_strTargetFile); 
	DDX_Text(pDX, IDC_EDIT_TIFFILE, m_strTifName); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CForthDlg, CDialog) 
	//{{AFX_MSG_MAP(CForthDlg) 
	ON_BN_CLICKED(IDC_BTN_FILE_SHOW, OnBtnFileShow) 
	ON_BN_CLICKED(IDC_BTN_PATH_SHOW, OnBtnPathShow) 
	ON_BN_CLICKED(IDC_BTN_AddTxtToTif, OnBTNAddTxtToTif) 
	ON_BN_CLICKED(IDC_BUTTON_TOOL, OnButtonTool) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CForthDlg message handlers 
 
void CForthDlg::OnOK()  
{ 
	// TODO: Add extra validation here 
	 
	//Dialog::OnOK(); 
} 
 
void CForthDlg::OnCancel()  
{ 
	// TODO: Add extra cleanup here 
 
//	CDialog::OnCancel(); 
} 
 
void CForthDlg::OnBtnFileShow()  
{ 
	UpdateData(); 
	CFileDialog cf(1, NULL, NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Fax File(*.tif)|*.tif|Tiff File(*.tiff)|*.tiff|All File(*.*)|*.*|",NULL); 
	char path[MAX_PATH]; 
	strcpy(path, szCurrentPath); 
	cf.m_ofn.lpstrInitialDir = path; 
 
	if(cf.DoModal() == IDOK) 
	{ 
		strcpy(m_strTifName.GetBuffer(MAX_PATH), cf.GetPathName()); 
		//strcpy(szSendPathFile, cf.GetPathName()); 
		UpdateData(FALSE); 
		m_strTifName.ReleaseBuffer(-1); 
	}		 
} 
 
void CForthDlg::OnBtnPathShow()  
{ 
	UpdateData(); 
	CFileDialog cf(0, NULL, NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Fax File(*.tif)|*.tif|Tiff File(*.tiff)|*.tiff|All File(*.*)|*.*|",NULL); 
	char path[MAX_PATH]; 
	strcpy(path, szCurrentPath); 
	cf.m_ofn.lpstrInitialDir = path; 
 
	if(cf.DoModal() == IDOK) 
	{ 
		strcpy(m_strTargetFile.GetBuffer(MAX_PATH), cf.GetPathName()); 
		//strcpy(szSendPathFile, cf.GetPathName()); 
		UpdateData(FALSE); 
		m_strTargetFile.ReleaseBuffer(-1); 
	} 
 
} 
 
void CForthDlg::OnBTNAddTxtToTif()  
{ 
	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 CForthDlg::GetCurrectPath(LPSTR str) 
{ 
	strcpy(szCurrentPath, str); 
} 
 
void CForthDlg::OnButtonTool()  
{ 
	CToolDlg dlg; 
	dlg.DoModal(); 
}