📄 maindlg.cpp
字号:
// MainDlg.cpp : implementation file
//
#include "stdafx.h"
#include "InPone.h"
#include "MainDlg.h"
#include "BusDlg.h"
#include "Handlg.h"
#include "AduseDlg.h"
#include "LogSet1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainDlg dialog
CMainDlg::CMainDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMainDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMainDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CMainDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMainDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMainDlg, CDialog)
//{{AFX_MSG_MAP(CMainDlg)
ON_BN_CLICKED(IDC_BUSMA, OnBusma)
ON_BN_CLICKED(IDC_HANDMA, OnHandma)
ON_BN_CLICKED(IDC_ABOUT, OnAbout)
ON_BN_CLICKED(IDC_ADD, OnAdd)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMainDlg message handlers
void CMainDlg::OnBusma()
{
// TODO: Add your control notification handler code here
CBusDlg m_dlg;
m_dlg.DoModal();
}
void CMainDlg::OnHandma()
{
// TODO: Add your control notification handler code here
CHandlg m_hdlg;
m_hdlg.DoModal();
}
void CMainDlg::OnAbout()
{
// TODO: Add your control notification handler code here
//CAboutDlg m_dlg;
//m_dlg.DoModal();
}
void CMainDlg::OnAdd()
{
// TODO: Add your control notification handler code here
CAduseDlg m_userdlg;
if(m_userdlg.DoModal()!=IDOK)
return;
CLogSet1 m_loginset;
try
{
if(m_loginset.IsOpen())
m_loginset.Close();
m_loginset.m_strFilter.Format("UserName='%s'order by UserID ASC",m_userdlg.m_user.operator LPCTSTR());
m_loginset.Open(CRecordset::snapshot,NULL,CRecordset::none);
//判断是否有同名用户,如果有就退出
if(!m_loginset.IsEOF())
{
m_loginset.Close();
AfxMessageBox("同名用户已经存在");
return;
}
//增加用户
m_loginset.AddNew();
m_loginset.m_UserName=m_userdlg.m_user;
m_loginset.m_UserPwd=m_userdlg.m_password;
if(m_loginset.CanUpdate())
{
m_loginset.Update();
}
if(m_loginset.IsOpen())
m_loginset.Close();
AfxMessageBox("增加用户成功");
}
catch(CDBException *e)
{
e->ReportError();
return;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -