通讯录管理软件系统设计方案内容摘要:

AFX_VIRTUAL(CAboutDlg) protected: virtual void DoDataExchange(CDataExchange* pDX)。 // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: //{{AFX_MSG(CAboutDlg) //}}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) // No message handlers //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPrj01Dlg dialog CPrj01Dlg::CPrj01Dlg(CWnd* pParent /*=NULL*/) : CDialog(CPrj01Dlg::IDD, pParent) { //{{AFX_DATA_INIT(CPrj01Dlg) m_username = _T()。 m_password = _T()。 //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()LoadIcon(IDR_MAINFRAME)。 } void CPrj01Dlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX)。 //{{AFX_DATA_MAP(CPrj01Dlg) DDX_Control(pDX, IDC_REGISTER, m_RegStatic)。 DDX_Text(pDX, IDC_EDIT1, m_username)。 DDX_Text(pDX, IDC_EDIT2, m_password)。 //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CPrj01Dlg, CDialog) //{{AFX_MSG_MAP(CPrj01Dlg) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_BN_CLICKED(IDC_BUTTON1, OnEnter) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_BN_CLICKED(IDC_REGISTER, OnRegister) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPrj01Dlg message handlers BOOL CPrj01Dlg::OnInitDialog() { CDialog::OnInitDialog()。 // Add About... menu item to system menu. // IDM_ABOUTBOX must be in the system mand range. ASSERT((IDM_ABOUTBOX amp。 0xFFF0) == IDM_ABOUTBOX)。 ASSERT(IDM_ABOUTBOX 0xF000)。 CMenu* pSysMenu = GetSystemMenu(FALSE)。 if (pSysMenu != NULL) { CString strAboutMenu。 (IDS_ABOUTBOX)。 if (!()) { pSysMenuAppendMenu(MF_SEPARATOR)。 pSysMenuAppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu)。 } } // Set the icon for this dialog. The framework does this automatically // when the application39。 s main window is not a dialog SetIcon(m_hIcon, TRUE)。 // Set big icon SetIcon(m_hIcon, FALSE)。 // Set small icon // TODO: Add extra initialization here LoadUserData()。 return TRUE。 // return TRUE unless you set the focus to a control } void CPrj01Dlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID amp。 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout。 ()。 } 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 CPrj01Dlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this)。 // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) (), 0)。 // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON)。 int cyIcon = GetSystemMetrics(SM_CYICON)。 CRect rect。 GetClientRect(amp。 rect)。 int x = (() cxIcon + 1) / 2。 int y = (() cyIcon + 1) / 2。 // Draw the icon (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 CPrj01Dlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon。 } void CPrj01Dlg::OnEnter() { // TODO: Add your control notification handler code here UpdateData()。 if (m_username == || m_password == ) { return。 } int ret=checkUsername()。 if(ret==1) { m_loginUser=m_username。 m_username=。 m_password=。 UpdateData(FALSE)。 CMessage msgDlg。 =this。 thisShowWindow(SW_HIDE)。 ()。 PostQuitMessage(0)。 //退出函数 //CloseWindow()。 } else if(ret==0) { MessageBox(用户名或密码不正确,请重新输入。 ,错误 )。 } else if(ret==1) { MessageBox(用户名不存在„ ,错误 )。 } } void CPrj01Dlg::LoadUserData() { ifstream fs。 (data\\)。 while (!()) { CUserData tmpUD。 char field[256]。 fsfield。 =field。 fsfield。 =field。 (tmpUD)。 } } int CPrj01Dlg::checkUsername() { vectorCUserData::iterator it。 for (it=()。 it!=()。 it++) { if (m_username == itName) { if (m_password == itPassword) { return 1。 } else { return 0。 } } } return 1。 } void CPrj01Dlg::SaveUserData() { ofstream fs。 (data\\)。 if (!fs) { MessageBox(error)。 } vectorCUserData::iterator it。 for (it=()。 it!=()。 it++) { fsit(it())。 fsit(it())endl。 } } void CPrj01Dlg::OnButton2() { // TODO: Add your control notification handler code here m_username=。 m_password=。 UpdateData(FALSE)。 } void CPrj01Dlg::OnRegister() { // TODO: Add your control notification handler code here CRegister regDlg。 =this。 ()。 } 系统主界面主要程序部分 : // : implementation file // include include include include fstream include include include include include ifdef _DEBUG define new DEBUG_NEW undef THIS_FILE static char THIS_FILE[] = __FILE__。 endif ///////////////////////////////////////////////////////////////////////////// // CMessage dialog CMessage::CMessage(CWnd* pParent /*=NULL*/) : CDialog(CMessage::IDD, pParent) { // //{{AFX_DATA_INIT(CMessage)。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。