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

📄 logindlg.cpp

📁 自己帮家里人写的一个废品收购管理数据库系统
💻 CPP
字号:
// LoginDlg.cpp : implementation file
//

#include "stdafx.h"
#include "废品收购管理系统.h"
#include "LoginDlg.h"
#include "MainDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CLoginDlg dialog


CLoginDlg::CLoginDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CLoginDlg::IDD, pParent)
{
	EnableAutomation();
    //{{AFX_DATA_INIT(CLoginDlg)
	m_pwd = _T("");
	m_user = _T("");
	//}}AFX_DATA_INIT
}


void CLoginDlg::OnFinalRelease()
{
	// When the last reference for an automation object is released
	// OnFinalRelease is called.  The base class will automatically
	// deletes the object.  Add additional cleanup required for your
	// object before calling the base class.

	CDialog::OnFinalRelease();
}

void CLoginDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CLoginDlg)
	DDX_Text(pDX, IDC_PWD, m_pwd);
	DDX_Text(pDX, IDC_USER, m_user);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CLoginDlg, CDialog)
	//{{AFX_MSG_MAP(CLoginDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CLoginDlg, CDialog)
	//{{AFX_DISPATCH_MAP(CLoginDlg)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_ILoginDlg to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {E555CA8C-A60B-4445-A77B-CB9CAA78944E}
static const IID IID_ILoginDlg =
{ 0xe555ca8c, 0xa60b, 0x4445, { 0xa7, 0x7b, 0xcb, 0x9c, 0xaa, 0x78, 0x94, 0x4e } };

BEGIN_INTERFACE_MAP(CLoginDlg, CDialog)
	INTERFACE_PART(CLoginDlg, IID_ILoginDlg, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLoginDlg message handlers

//DEL void CLoginDlg::OnEnter() 
//DEL {
//DEL 	// TODO: Add your control notification handler code here
//DEL 	CoInitialize(NULL);
//DEL 	_ConnectionPtr pCon(_uuidof(Connection));
//DEL 	_RecordsetPtr  pRec(_uuidof(Recordset));
//DEL 
//DEL 	pCon->ConnectionTimeout=5;
//DEL     pCon->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=废品交易数据库.mdb","","",adModeUnknown);
//DEL 
//DEL 	CString strSQL;
//DEL 	UpdateData(TRUE);
//DEL 	strSQL.Format("SELECT * FROM 用户名与密码表 WHERE 用户名='%s' AND 密码='%s'",m_user,m_pwd);
//DEL 	
//DEL 	pRec->Open(_bstr_t(strSQL),
//DEL 			        _variant_t((IDispatch*)pCon,true),
//DEL 					adOpenStatic,
//DEL 					adLockOptimistic,
//DEL 					adCmdText					
//DEL 					);
//DEL 
//DEL 	if(pRec->GetRecordCount()==0)
//DEL 	{
//DEL 		m_user="";
//DEL 		m_pwd="";
//DEL 		UpdateData(FALSE);
//DEL 		MessageBox("输入用户名或密码错误!");
//DEL 		
//DEL 	}
//DEL 	else
//DEL 	{
//DEL 		OnOK();
//DEL 		CMainDlg MainDlg;
//DEL 	    MainDlg.DoModal();
//DEL 	    
//DEL 	}
//DEL 	pRec->Close();
//DEL 	pCon->Close();
//DEL 	pRec.Release();
//DEL 	pCon.Release();
//DEL 	CoUninitialize();
//DEL 		
//DEL }

BOOL CLoginDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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