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

📄 dlglogo.cpp

📁 这个是一个比较全的超市管理系统
💻 CPP
字号:
// DlgLogo.cpp : implementation file
//

#include "stdafx.h"
#include "NCShop.h"
#include "DlgLogo.h"
#include "ADOConn.h"
#include "MyTime.h"
#include "FileOperate.h"
#include ".\dlglogo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgLogo dialog


CDlgLogo::CDlgLogo(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgLogo::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgLogo)
	m_str1 = _T("");
	m_str2 = _T("");
	//}}AFX_DATA_INIT
}


void CDlgLogo::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgLogo)
	DDX_Control(pDX, IDCANCEL, m_Btn2);
	DDX_Control(pDX, IDOK, m_Btn1);
	DDX_Text(pDX, IDC_EDIT1, m_str1);
	DDV_MaxChars(pDX, m_str1, 50);
	DDX_Text(pDX, IDC_EDIT2, m_str2);
	DDV_MaxChars(pDX, m_str2, 255);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgLogo, CDialog)
	//{{AFX_MSG_MAP(CDlgLogo)
	ON_WM_CTLCOLOR()
	//}}AFX_MSG_MAP
	ON_BN_CLICKED(IDOK, OnBnClickedOk)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgLogo message handlers

BOOL CDlgLogo::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	GetDlgItem(IDC_STATICHEAD)->SetWindowText("进销存管理系统");
	GetDlgItem(IDC_EDIT1)->SetWindowText("A001");
	GetDlgItem(IDC_EDIT2)->SetWindowText("admin");
	GetDlgItem(IDC_STATICHEAD)->SetFont(&ftPart);
	m_Btn1.SetXIcon(IDI_ICONBUTTON);
	m_Btn2.SetXIcon(IDI_ICONBUTTON);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

HBRUSH CDlgLogo::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	HBRUSH hbr1;
	switch(nCtlColor)
	{
	case CTLCOLOR_DLG://窗体颜色
		hbr1=CreateSolidBrush(RGB(255,255,247));
		return hbr1;
	case CTLCOLOR_STATIC://静态文本的颜色
		pDC->SetBkMode(TRANSPARENT);
		hbr1=CreateSolidBrush(RGB(255,255,247));
		return hbr1;
	default:
		return hbr;	
	}	
	// TODO: Return a different brush if the default is not desired
}

void CDlgLogo::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(TRUE);
	CString strSql;
	CADOConn adoMain;
	CFileOperate fileMain;
	CString strPath;
	CMyTime time1;
	CFile file1;
	strSql="select * from 管理员基本信息表 where 编号='";
	strSql=strSql+m_str1+"' and 密码='";
	strSql=strSql+m_str2+"'";
	time1.SetNow();
	strfileName=time1.GetSimpleString();
	strPath=fileMain.GetAppPath()+"\\data\\LOG\\"+strfileName+".txt";
	file1.Open(strPath,CFile::modeWrite|CFile::shareDenyNone|CFile::modeCreate,NULL);
	file1.SeekToEnd();
	strPath="\r\n    "+time1.GetAllString(FALSE)+"    "+m_str1+"    开始登陆 ";
	file1.Write(strPath,strPath.GetLength());
	file1.Close();	
	adoMain.Open(strSql);
	if(!adoMain.adoEOF())
	{	
		strName=adoMain.GetValueString(1,0);
		strNo=m_str1;
		CDialog::OnOK();
	}
	else
		MessageBox("密码或编号错误!","提示",MB_OK+MB_ICONWARNING);
	adoMain.ExitConnect();

}

void CDlgLogo::OnBnClickedOk()
{
	// TODO: 在此添加控件通知处理程序代码
	OnOK();
}

⌨️ 快捷键说明

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