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

📄 dialogpwd.cpp

📁 vc++6.0与orcale的连接及对orcale数据库数据的提取
💻 CPP
字号:
// DialogPWD.cpp : implementation file
//

#include "stdafx.h"
#include "Chbhf.h"
#include "DialogPWD.h"
#include "ChbhfDlg.h"
#include "PASSWORD.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDialogPWD dialog


CDialogPWD::CDialogPWD(CWnd* pParent /*=NULL*/)
	: CDialog(CDialogPWD::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDialogPWD)
	m_user = _T("");
	m_password = _T("");
	//}}AFX_DATA_INIT
}


void CDialogPWD::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDialogPWD)
	DDX_Text(pDX, IDC_EDIT1, m_user);
	DDX_Text(pDX, IDC_EDIT2, m_password);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDialogPWD, CDialog)
	//{{AFX_MSG_MAP(CDialogPWD)
	ON_BN_CLICKED(IDC_dl, Ondl)
	ON_BN_CLICKED(IDC_QX, OnQx)
	ON_WM_CLOSE()
	ON_WM_PAINT()
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDialogPWD message handlers

void CDialogPWD::Ondl() 
{ 
	 

	//  CDialogPWD::OnOK();
     	// TODO: Add your control notification handler code here
    CPASSWORD *m_recordset=new CPASSWORD(&m_database);
	CString strSQL;

	UpdateData(true);
	strSQL.Format("select * from TBL_PASSWORD where RYBH='%s' AND PASS='%s'",m_user,m_password);
	m_recordset->Open(AFX_DB_USE_DEFAULT_TYPE,strSQL);
	if(m_recordset->GetRecordCount()==0){
		if(count<3){
			MessageBox("login or password incorrect!");
			count++;
	
		}
		else{
			MessageBox("too many trials");
		CDialogPWD::OnOK();

	
		}
	}
	else{
			CDialogPWD::OnOK();
		user.Format("%s",m_user);
		CChbhfDlg m_Main;
		m_Main.user.Format("%s",m_user);
		m_Main.user=m_user;
      	UpdateData(false);
     
    	m_Main.DoModal();
    
	}	
}

void CDialogPWD::OnQx() 
{	

	
	  CDialogPWD::OnOK();// TODO: Add your control notification handler code here
	
}

void CDialogPWD::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	
CDialogPWD::OnOK();
}

BOOL CDialogPWD::OnInitDialog() 
{
	CDialog::OnInitDialog();
		count =0;
		SetWindowText("用户登陆窗口");

	//	SetBkMode(NULL,1);
	//	CDialog::SetRedraw(TRUE);
	m_brush .CreateSolidBrush (RGB ( 50, 100, 200 ) ) ;
		//SetBkColor(RGB(0,200,0));
		
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDialogPWD::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
/*	RECT rect;
	this->GetClientRect(&rect);
	CBrush BGBrush;
	BGBrush.CreateSolidBrush(RGB(100,80,0));
	dc.SelectObject(&BGBrush);
	dc.Rectangle(&rect);*/	
	// Do not call CDialog::OnPaint() for painting messages
}

HBRUSH CDialogPWD::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
		HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	// TODO: Change any attributes of the DC here


    hbr=m_brush;
    if (nCtlColor==CTLCOLOR_STATIC )
	{ pDC->SetTextColor (RGB (255,255,255 ) ) ;

    pDC->SetBkColor (RGB (50,100,200)); }
	if (nCtlColor==CTLCOLOR_EDIT )
    {pDC->SetTextColor (RGB (255,255,255 ) ) ;
    pDC->SetBkColor (RGB (50,100,200)); }
	
	// TODO: Return a different brush if the default is not desired
	return hbr;
}

⌨️ 快捷键说明

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