IDE development <ler-studio> (2): logon Module

Source: Internet
Author: User

The write logon module in the software is used to prevent malicious spread of the software. You can ignore logon during the internal test phase.

The main source code of the logon module is as follows:

void CLoginDlg::OnBnClickedBtnLogin(){// TODO: Add your control notification handler code hereCClerkDataSet lgDataSet;CString strSQL=L"";UpdateData(TRUE);CMFC_Library_RibbonView* pView;pView=((CMFC_Library_RibbonView*)((CMainFrame*)AfxGetMainWnd())->GetActiveView());if (m_strName.IsEmpty()){MessageBox(L"请输入用户名!",L"提示",MB_ICONWARNING);return;}else if(m_strPWD.IsEmpty()){MessageBox(L"请输入密码!",L"提示",MB_ICONWARNING);return;}strSQL=L"SELECT * FROM CLERK WHERE NAME=‘";strSQL=strSQL+m_strName;strSQL=strSQL+L"‘ AND PASSWORD=‘";strSQL=strSQL+m_strPWD;strSQL=strSQL+L"‘";if (!lgDataSet.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL)){MessageBox(L"打开CLERK表失败!",L"提示",MB_ICONWARNING);return;}    if (m_strName=="rong"&&m_strPWD=="123456"){m_strUSERID=lgDataSet.m_CLERK_ID;m_bSuccess=TRUE;MessageBox(L"登陆成功!",L"成功");pView->m_strUserId=m_strUSERID;pView->m_bLogin=m_bSuccess;pView->m_strUserName=m_strName;CString name=L"图书管理系统V1.0-当前登录用户:"+m_strName;((CMainFrame *)AfxGetApp()-> m_pMainWnd)->SetWindowText(name);Invalidate();CDialog::OnOK();DestroyWindow();}else{MessageBox(L"登录失败!用户名或密码不正确!",L"登录失败!",MB_ICONERROR);SetDlgItemText(IDC_EDIT_USERNAME,L"");SetDlgItemText(IDC_EDIT_PWD,L"");GetDlgItem(IDC_EDIT_USERNAME)->SetFocus();pView->m_strUserName=L"";pView->m_bLogin=m_bSuccess;pView->m_strUserId=L"";return;}}

This is the logon interface (ugly version ):

My personal blog address: http://ler.look.in

Ler-studio Official Website: http://studio.look.in

IDE development <ler-studio> (2): logon Module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.