📄 inquire.cpp
字号:
// inquire.cpp : implementation file
//
#include "stdafx.h"
#include "salsary.h"
#include "inquire.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// inquire dialog
inquire::inquire(CWnd* pParent /*=NULL*/)
: CDialog(inquire::IDD, pParent)
{
//{{AFX_DATA_INIT(inquire)
m_user = _T("");
m_name = _T("");
m_salary = _T("");
m_age = _T("");
//}}AFX_DATA_INIT
}
void inquire::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(inquire)
DDX_Text(pDX, IDC_user, m_user);
DDV_MaxChars(pDX, m_user, 10);
DDX_Text(pDX, IDC_name, m_name);
DDV_MaxChars(pDX, m_name, 10);
DDX_Text(pDX, IDC_salary, m_salary);
DDV_MaxChars(pDX, m_salary, 10);
DDX_Text(pDX, IDC_age, m_age);
DDV_MaxChars(pDX, m_age, 10);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(inquire, CDialog)
//{{AFX_MSG_MAP(inquire)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// inquire message handlers
#include"salsaryDlg.h"
#include"wh.h"
BOOL inquire::OnInitDialog()
{
CDialog::OnInitDialog();
CSalsaryDlg*ptr=(CSalsaryDlg*)::AfxGetApp()->GetMainWnd();
fstream f("C:\\user.dat",ios::binary|ios::in|ios::out);
if(!f)
{cerr<<"文件不能打开"<<endl;
return FALSE;
}
user_data data;
f.seekp(0,ios::end);
long posEnd=f.tellp();
f.seekp(0,ios::beg);
CString user;
do
{f.read((char*)&data,sizeof(user_data));
user=data.user;
}while((ptr->m_userID).Compare(user)&&f.tellp()!=posEnd);
if(!(ptr->m_userID).Compare(user))
{m_user=data.user;
m_name=data.name;
m_age.Format("%d",(data.age));
m_salary.Format("%d",(data.salary));
UpdateData(FALSE);}
else MessageBox("程序出错!");
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -