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


// SecondDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "atrkfax.h" 
#include "SecondDlg.h" 
#include "../../../../../../api/vc6.0/inc/shpa3api.h" 
#include "AtrkFaxDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CSecondDlg dialog 
 
 
CSecondDlg::CSecondDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CSecondDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CSecondDlg) 
	m_bHaveStartPage = FALSE; 
	m_strCallNo = _T(""); 
	m_strSendFile = _T(""); 
	m_nEndPage = 0; 
	m_nStartPage = 0; 
	m_strStartPage = _T(""); 
	m_strEndPage = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CSecondDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CSecondDlg) 
	DDX_Control(pDX, IDC_CMB_TRUNK, m_cmbTrunkCh); 
	DDX_Control(pDX, IDC_CMB_FAX, m_cmbFaxCh); 
	DDX_Check(pDX, IDC_CHECK_CHOOSE_START_PAGE, m_bHaveStartPage); 
	DDX_Text(pDX, IDC_EDIT_CALL_NO, m_strCallNo); 
	DDX_Text(pDX, IDC_EDIT_SENDFILE, m_strSendFile); 
	DDX_Text(pDX, IDC_EDIT_START_PAGE, m_strStartPage); 
	DDX_Text(pDX, IDC_EDIT_END_PAGE, m_strEndPage); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CSecondDlg, CDialog) 
	//{{AFX_MSG_MAP(CSecondDlg) 
	ON_BN_CLICKED(IDC_2DLG_SENDFILE_BTN, On2dlgSendfileBtn) 
	ON_BN_CLICKED(IDC_CHECK_CHOOSE_START_PAGE, OnCheckChooseStartPage) 
	ON_BN_CLICKED(IDC_2DLG_AUTOSEND_BTN, On2dlgAutosendBtn) 
	ON_EN_CHANGE(IDC_EDIT_START_PAGE, OnChangeEditStartPage) 
	ON_EN_CHANGE(IDC_EDIT_END_PAGE, OnChangeEditEndPage) 
	ON_EN_CHANGE(IDC_EDIT_CALL_NO, OnChangeEditCallNo) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CSecondDlg message handlers 
 
void CSecondDlg::OnOK()  
{ 
	// TODO: Add extra validation here 
	 
	//CDialog::OnOK(); 
} 
 
void CSecondDlg::OnCancel()  
{ 
	// TODO: Add extra cleanup here 
	 
	//CDialog::OnCancel(); 
} 
 
void CSecondDlg::On2dlgSendfileBtn()  
{ 
	CFileDialog cf(1, NULL, NULL, OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, "Fax File(*.tif)|*.tif|Tif File(*.fax)|*.fax|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_strSendFile.GetBuffer(MAX_PATH), cf.GetFileName()); 
		strcpy(szSendFile, cf.GetPathName()); 
		UpdateData(FALSE); 
		m_strSendFile.ReleaseBuffer(-1); 
	} 
} 
 
 
void CSecondDlg::OnCheckChooseStartPage() 
{ 
	UpdateData(); 
	bHaveStartPage = m_bHaveStartPage; 
	CWnd *p = GetDlgItem(IDC_EDIT_START_PAGE); 
	p->EnableWindow(bHaveStartPage); 
	p = GetDlgItem(IDC_EDIT_END_PAGE); 
	p->EnableWindow(bHaveStartPage); 
 
} 
 
void CSecondDlg::On2dlgAutosendBtn()  
{ 
	CWnd *p = GetParent(); 
	HWND hwnd = p->m_hWnd; 
	CString strFax,strTrunk; 
	CString str; 
	int		nTrunk; 
 
	UpdateData(); 
	m_cmbFaxCh.GetWindowText(strFax); 
	m_cmbTrunkCh.GetWindowText(strTrunk); 
 
	if(strTrunk.IsEmpty()) 
	{ 
		MessageBox("please set trunk channel","Warning",MB_OK); 
		nTrunk = -1; 
		return; 
	} 
	else 
		nTrunk = atoi(strTrunk); 
 
	if(m_strCallNo.IsEmpty()) 
	{ 
		MessageBox("Please input calledId","Warning",MB_OK); 
		return; 
	} 
 
	if(m_strSendFile.IsEmpty()) 
	{ 
		MessageBox("Please select file to send","Warning",MB_OK); 
		return; 
	} 
	 
	if(SsmGetChState(nTrunk) != S_CALL_STANDBY) 
	{ 
		str.Format("trunk channel %d is busy",nTrunk); 
		MessageBox(str,"Warning",MB_OK); 
		return; 
	} 
 
	//::SendMessage(hwnd, AUTOSENDFAX,nFax,nTrunk); 
	//::PostMessage(HWND_BROADCAST, AUTOSENDFAX,nFax,nTrunk); 
	((CAtrkFaxDlg *)p)->AutoSendFaxEx(); 
} 
 
void CSecondDlg::OnChangeEditStartPage()  
{ 
	// TODO: If this is a RICHEDIT control, the control will not 
	// send this notification unless you override the CDialog::OnInitDialog() 
	// function and call CRichEditCtrl().SetEventMask() 
	// with the ENM_CHANGE flag ORed into the mask. 
	 
	// TODO: Add your control notification handler code here 
	UpdateData(); 
	if(m_strStartPage.IsEmpty()) 
	{ 
		m_nStartPage = 0; 
	} 
	else 
		m_nStartPage = atoi(m_strStartPage); 
} 
 
void CSecondDlg::OnChangeEditEndPage()  
{ 
	// TODO: If this is a RICHEDIT control, the control will not 
	// send this notification unless you override the CDialog::OnInitDialog() 
	// function and call CRichEditCtrl().SetEventMask() 
	// with the ENM_CHANGE flag ORed into the mask. 
	// TODO: Add your control notification handler code here 
	UpdateData(); 
	if(m_strEndPage.IsEmpty()) 
		m_nEndPage = 0; 
	else 
		m_nEndPage = atoi(m_strEndPage); 
	 
} 
 
void CSecondDlg::GetCurrentPath(LPSTR str) 
{ 
	strcpy(szCurrentPath, str); 
} 
 
void CSecondDlg::OnChangeEditCallNo()  
{ 
	// TODO: If this is a RICHEDIT control, the control will not 
	// send this notification unless you override the CDialog::OnInitDialog() 
	// function and call CRichEditCtrl().SetEventMask() 
	// with the ENM_CHANGE flag ORed into the mask. 
	 
	// TODO: Add your control notification handler code here 
	UpdateData(); 
}