mymaindialog.cpp
上传用户:yhxbjx
上传日期:2018-11-07
资源大小:7142k
文件大小:5k
- // mymaindialog.cpp : implementation file
- //
- #include "stdafx.h"
- #include "sheji2.h"
- #include "mymaindialog.h"
- #include "mynewdialog2.h"
- #include "mynewdialog3.h"
- #include "mynewdialog4.h"
- #include "mynewdialog5.h"
- #include "myrecordset.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- myrecordset a;
- /////////////////////////////////////////////////////////////////////////////
- // mymaindialog dialog
- mymaindialog::mymaindialog(CWnd* pParent /*=NULL*/)
- : CDialog(mymaindialog::IDD, pParent)
- {
- //{{AFX_DATA_INIT(mymaindialog)
- id = _T("");
- name = _T("");
- wp = _T("");
- hp = _T("");
- fp = _T("");
- ip = _T("");
- //}}AFX_DATA_INIT
- }
- void mymaindialog::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(mymaindialog)
- DDX_Text(pDX, IDC_EDIT1, id);
- DDX_Text(pDX, IDC_EDIT2, name);
- DDX_Text(pDX, IDC_EDIT3, wp);
- DDX_Text(pDX, IDC_EDIT4, hp);
- DDX_Text(pDX, IDC_EDIT5, fp);
- DDX_Text(pDX, IDC_EDIT6, ip);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(mymaindialog, CDialog)
- //{{AFX_MSG_MAP(mymaindialog)
- ON_COMMAND(ID_MENUITEM32773, OnMenuitem32773)
- ON_COMMAND(ID_MENUITEM32774, OnMenuitem32774)
- ON_COMMAND(ID_MENUITEM32775, OnMenuitem32775)
- ON_COMMAND(ID_MENUITEM32776, OnMenuitem32776)
- ON_COMMAND(ID_MENUITEM32777, OnMenuitem32777)
- ON_COMMAND(ID_MENUITEM32778, OnMenuitem32778)
- ON_COMMAND(ID_MENUITEM32779, OnMenuitem32779)
- ON_WM_CANCELMODE()
- ON_COMMAND(ID_MENUITEM32790, OnMenuitem32790)
- ON_COMMAND(ID_setclear, Onsetclear)
- ON_COMMAND(ID_setsearch, Onsetsearch)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // mymaindialog message handlers
- void mymaindialog::OnOK()
- {
- // TODO: Add extra validation here
-
- UpdateData();
- int flag=0;
- myrecordset a;
- a.Open();
- while(!a.IsEOF())
- {if(name==a.m_name&&id==a.m_ID&&wp==a.m_workplace&&hp==a.m_address&&fp==a.m_fixphone&&ip==a.m_phone)
- {flag=1;
- MessageBox("数据库发现资源!");
- break;}
- a.MoveNext();
- }
- if(flag==0)
- {MessageBox("未发现!!");}
- }
- void mymaindialog::OnMenuitem32773()
- {
- // TODO: Add your command handler code here
- mynewdialog2 a;
- a.DoModal();
- }
- void mymaindialog::OnMenuitem32774()
- {
- // TODO: Add your command handler code here
- mynewdialog3 a;
- a.DoModal();
- }
- void mymaindialog::OnMenuitem32775()
- {
- // TODO: Add your command handler code here
- mynewdialog4 a;
- a.DoModal();
- }
- void mymaindialog::OnMenuitem32776()
- {
- // TODO: Add your command handler code here
- UpdateData();
- //a.Open();
- a.MoveFirst();
- id=a.m_ID;
- name=a.m_name;
- wp=a.m_workplace;
- hp=a.m_address;
- fp=a.m_fixphone;
- ip=a.m_phone;
- UpdateData(false);
- }
- void mymaindialog::OnMenuitem32777()
- {
- // TODO: Add your command handler code here
- UpdateData();
- //a.Open();
- a.MovePrev();
- id=a.m_ID;
- name=a.m_name;
- wp=a.m_workplace;
- hp=a.m_address;
- fp=a.m_fixphone;
- ip=a.m_phone;
- UpdateData(false);
- if(a.IsBOF())
- MessageBox("已到第一个记录!!!","提示",64);
- }
- void mymaindialog::OnMenuitem32778()
- {
- // TODO: Add your command handler code here
- UpdateData();
- a.MoveNext();
- id=a.m_ID;
- name=a.m_name;
- wp=a.m_workplace;
- hp=a.m_address;
- fp=a.m_fixphone;
- ip=a.m_phone;
- UpdateData(false);
- if(a.IsEOF())
- {MessageBox("已到最后一个记录!!!","提示",64);}
-
- }
- void mymaindialog::OnMenuitem32779()
- {
- // TODO: Add your command handler code here
- UpdateData();
- a.MoveLast();
- id=a.m_ID;
- name=a.m_name;
- wp=a.m_workplace;
- hp=a.m_address;
- fp=a.m_fixphone;
- ip=a.m_phone;
- UpdateData(false);
- }
- BOOL mymaindialog::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- a.Open();
- m_TBr.Create(this);
- m_TBr.LoadToolBar(IDR_TOOLBAR1);
- RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void mymaindialog::OnCancelMode()
- {
- CDialog::OnCancelMode();
-
- // TODO: Add your message handler code here
-
- }
- void mymaindialog::OnMenuitem32790()
- {
- // TODO: Add your command handler code here
- mymaindialog::OnCancel();
- }
- void mymaindialog::Onsetclear()
- {
- // TODO: Add your command handler code here
- UpdateData();
- id="";
- name="";
- wp="";
- hp="";
- fp="";
- ip="";
- UpdateData(false);
- }
- void mymaindialog::Onsetsearch()
- {
- // TODO: Add your command handler code here
- mynewdialog5 a;
- a.DoModal();
- }