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


// FirstDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Fax_Event_VC.h" 
#include "FirstDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CFirstDlg dialog 
 
 
CFirstDlg::CFirstDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CFirstDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CFirstDlg) 
	m_strRcvPath = _T(""); 
	m_strRcvFile = _T(""); 
	//}}AFX_DATA_INIT 
} 
 
 
void CFirstDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CFirstDlg) 
	DDX_Text(pDX, IDC_EDIT_RECEIVE_PATH, m_strRcvPath); 
	DDX_Text(pDX, IDC_EDIT_RECEIVE_FILE, m_strRcvFile); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CFirstDlg, CDialog) 
	//{{AFX_MSG_MAP(CFirstDlg) 
	ON_BN_CLICKED(IDC_BUTTON_RECEIVE_PATH, OnButtonReceivePath) 
	ON_EN_CHANGE(IDC_EDIT_RECEIVE_FILE, OnChangeEditReceiveFile) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CFirstDlg message handlers 
 
void CFirstDlg::OnButtonReceivePath()  
{ 
	// TODO: Add your control notification handler code here 
	char t[] = "please choose the route to save fax files"; 
	BROWSEINFO bi; 
	LPMALLOC pMalloc; 
		 
	if(SUCCEEDED(SHGetMalloc(&pMalloc)))  
	{ 
		ZeroMemory(&bi, sizeof(bi)); 
		bi.hwndOwner		= NULL; 
		bi.pszDisplayName	= 0; 
		bi.lpszTitle		= t; 
		bi.pidlRoot			= 0; 
		bi.ulFlags			= BIF_RETURNONLYFSDIRS; 
		bi.lpfn				= BrowseCallbackProc; 
 
		LPITEMIDLIST pidl = SHBrowseForFolder(&bi); 
		if(pidl)  
		{ 
			if(SHGetPathFromIDList(pidl, m_strRcvPath.GetBuffer(MAX_PATH)))  
			{ 
				UpdateData(FALSE); 
			} 
			pMalloc->Free(pidl); 
			pMalloc->Release(); 
		} 
	} 
} 
 
 
void CFirstDlg::OnChangeEditReceiveFile()  
{ 
	// 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(); 
} 
 
 
void CFirstDlg::InitLab() 
{ 
	if(g_dwLanguageConversion == g_dwCHINESE_SIMPLIFIED) 
	{ 
		//Chinese 
		strLab[0].Format("接收文件"); 
		strLab[1].Format("接收路径"); 
		strLab[2].Format("浏览"); 
	} 
	else 
	{	//English 
		strLab[0].Format("File name received");	 
		strLab[1].Format("Path for receiving file"); 
		strLab[2].Format("Browse"); 
	} 
	SetWinTextLab(this, IDC_STATIC_RECEIVE_FILE, strLab[0]); 
	SetWinTextLab(this, IDC_STATIC_RECEIVE_PATH, strLab[1]); 
	SetWinTextLab(this, IDC_BUTTON_RECEIVE_PATH, strLab[2]); 
} 
 
 
BOOL CFirstDlg::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 
}