⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logodig.cpp

📁 一个完整的VC对数据库操作的实例
💻 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);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -