www.pudn.com > AccessADO.rar > LogoDig.cpp


// LogoDig.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Access.h" 
#include "LogoDig.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CLogoDig dialog 
 
 
CLogoDig::CLogoDig(CWnd* pParent /*=NULL*/) 
	: CDialog(CLogoDig::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CLogoDig) 
	m_nSrcType = 0; 
	m_strDbName = _T(""); 
	m_strPassWord = _T(""); 
	m_strUserName = _T(""); 
	m_strSrcName = _T(""); 
	//}}AFX_DATA_INIT 
	m_bAdvaced = FALSE; 
} 
 
 
void CLogoDig::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CLogoDig) 
	DDX_Control(pDX, IDC_FILENAME, m_buttonExplorer); 
	DDX_CBIndex(pDX, IDC_SRC_COMBO, m_nSrcType); 
	DDX_Text(pDX, IDC_DBNAME_EDIT, m_strDbName); 
	DDX_Text(pDX, IDC_PASSWORD_EDIT, m_strPassWord); 
	DDX_Text(pDX, IDC_USERNAME_EDIT, m_strUserName); 
	DDX_Text(pDX, IDC_FILENAME_EDIT, m_strSrcName); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CLogoDig, CDialog) 
	//{{AFX_MSG_MAP(CLogoDig) 
	ON_BN_CLICKED(IDC_FILENAME, OnFilename) 
	ON_CBN_SELENDOK(IDC_SRC_COMBO, OnSelendokSrcCombo) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CLogoDig message handlers 
 
void CLogoDig::OnOK()  
{ 
	UpdateData(); 
	if (((m_nSrcType == 0) && m_strSrcName == "") || ( (m_nSrcType == 1)  
		&& (m_strSrcName == "" || m_strUserName == "" || m_strPassWord == "" || m_strDbName == "")) ) 
	{ 
		AfxMessageBox("你没有输入完整的登录信息!"); 
		return; 
	} 
	CDialog::OnOK(); 
} 
 
void CLogoDig::OnFilename()  
{ 
	// TODO: Add your control notification handler code here 
	CFileDialog dlg(TRUE); 
	if (dlg.DoModal() == IDOK) 
	{ 
		m_strSrcName = dlg.GetPathName(); 
		UpdateData(FALSE); 
	} 
} 
 
BOOL CLogoDig::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	CRect rect; 
	this->GetWindowRect(&rect); 
	rect.bottom = rect.top + 210; 
	this->MoveWindow(rect); 
	this->CenterWindow(); 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CLogoDig::OnSelendokSrcCombo()  
{ 
	CRect rect; 
	GetWindowRect(&rect); 
 
	UpdateData(); 
	if (m_nSrcType == 0) 
	{ 
		m_buttonExplorer.ShowWindow(SW_SHOW); 
		rect.bottom = rect.top + 210; 
		MoveWindow(rect); 
	} 
	else 
	{ 
		m_buttonExplorer.ShowWindow(SW_HIDE); 
		rect.bottom = rect.top + 380; 
		MoveWindow(rect); 
	} 
}