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

📄 ppjlbdlg.cpp

📁 乒乓球俱乐部管理系统
💻 CPP
字号:
// ppjlbDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ppjlb.h"
#include "ppjlbDlg.h"
#include "HyperLink.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define IDS_WEBADDR		_T("http://www.softechsoftware.it")
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();
	CHyperLink	m_HomePageLink;
// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	//{{AFX_MSG(CAboutDlg)
	virtual BOOL OnInitDialog();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

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

/////////////////////////////////////////////////////////////////////////////
// CPpjlbDlg dialog

CPpjlbDlg::CPpjlbDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPpjlbDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPpjlbDlg)
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CPpjlbDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPpjlbDlg)
	DDX_Control(pDX, IDC_EDIT2, m_userpass);
	DDX_Control(pDX, IDC_EDIT1, m_username);
	//}}AFX_DATA_MAP
	//DDX_Control(pDX, IDOK, m_login);
	//DDX_Control(pDX, IDC_SEARCH, ss);

}

BEGIN_MESSAGE_MAP(CPpjlbDlg, CDialog)
	//{{AFX_MSG_MAP(CPpjlbDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPpjlbDlg message handlers

BOOL CPpjlbDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	m_username.SetFocus();

	// Add "About..." menu item to system menu.
	
	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

/*	HICON hIcon=AfxGetApp()->LoadIcon(IDI_ICON1);
	CButton *pButton=(CButton*)GetDlgItem(IDOK);
	pButton->SetIcon(hIcon);*/

	// TODO: Add extra initialization here
	//m_login.SubclassDlgItem(IDOK,this);
	//m_login.SetIcon(IDI_ICON1);
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CPpjlbDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CPpjlbDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CPpjlbDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CPpjlbDlg::OnOK()                      //登陆框“确定”按钮消息函数
{
	// TODO: Add extra validation here
	CString un,up;                          //用于处理编辑框中的字符串
	bool flag;                              //用于判断是否为合法用户
	m_username.GetWindowText(un);			//将字符串赋给un
	m_userpass.GetWindowText(up);			//将字符串赋给up
	if(un=="") 
	{
		MessageBox("用户名不能为空","小昕提示",MB_ICONINFORMATION);
		m_username.SetFocus();             //提示输入用户名
	}
	else
	{
		if(up=="") 
		{
			MessageBox("输入密码","小昕提示",MB_ICONINFORMATION);
			m_userpass.SetFocus();         //提示输入密码
		}
		else
		{
			log.Open();                    //打开login表
			log.MoveFirst();               //指到第一个记录处
			while(!log.IsEOF())			   //循环进行匹配
			{
				if(un==log.m_memuser)
				{
					if(up==log.m_mempass)
					{ 
						flag=false;	break;	//和login表中匹配则标记flag	
					}
					else log.MoveNext();
				}	
				else log.MoveNext();
			}
			log.Close();                    //关闭login表
			if(flag) 
			{
				MessageBox("用户名,密码输入错误!请重新输入","错误提示",MB_ICONWARNING);
				m_userpass.SetWindowText(0);
				m_username.SetFocus();      //使用户名编辑框得到焦点
				m_username.SetSel(0,-1);	//与上句共同达到方便操作的目的
			}
			else
			{
				MessageBox("欢迎进入凤峰俱乐部成员管理系统","登陆成功",MB_OK|MB_ICONINFORMATION);
				OnCancel();                 //关闭登陆框
				CMainFun cm;
				cm.DoModal();               //弹出主程序窗口
			}
		
		}
	}
}

BOOL CAboutDlg::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
}



void CPpjlbDlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
}

⌨️ 快捷键说明

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