📄 mineinfo.cpp
字号:
// UserInfo.cpp : implementation file
//
#include "stdafx.h"
#include "NetQQ.h"
#include "MineInfo.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMineInfo dialog
CMineInfo::CMineInfo(CWnd* pParent /*=NULL*/)
: CDialog(CMineInfo::IDD, pParent)
{
m_pMainDlg = (CMainDlg*)pParent;
//{{AFX_DATA_INIT(CMineInfo)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CMineInfo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMineInfo)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMineInfo, CDialog)
//{{AFX_MSG_MAP(CMineInfo)
ON_BN_CLICKED(IDC_BTN_OK, OnBtnOk)
ON_BN_CLICKED(IDC_BTN_AMEND, OnBtnAmend)
ON_BN_CLICKED(IDC_BTN_TIJIAO, OnBtnTijiao)
ON_WM_CLOSE()
ON_WM_DESTROY()
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_BN_CLICKED(IDC_BUT_MIN1, OnButMin)
ON_BN_CLICKED(IDC_BUT_CLOSE1, OnCloseWin)
ON_BN_CLICKED(IDC_BTN_V, OnBtnV)
//}}AFX_MSG_MAP
ON_MESSAGE(WM_MEINFO, OnMeInfo)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMineInfo message handlers
/************************关闭窗口*****************/
void CMineInfo::OnBtnOk()
{
// TODO: Add your control notification handler code here
OnClose();
}
/**********************点修改按钮将所有广西框激活******************/
void CMineInfo::OnBtnAmend()
{
// TODO: Add your control notification handler code here
((CEdit*)(GetDlgItem(IDC_EDIT_USEN)))->SetReadOnly(FALSE);
((CEdit*)(GetDlgItem(IDC_EDIT_USEREMAL)))->SetReadOnly(FALSE);
((CEdit*)(GetDlgItem(IDC_EDIT_USET)))->SetReadOnly(FALSE);
((CButton*)(GetDlgItem(IDC_BTN_TIJIAO)))->EnableWindow(TRUE);
((CComboBox *)(GetDlgItem(IDC_COMBO_UserSex)))->EnableWindow(TRUE);
((CComboBox *)(GetDlgItem(IDC_COMBO_UserDptm)))->EnableWindow(TRUE);
((CComboBox *)(GetDlgItem(IDC_COMBO_UserDuty)))->EnableWindow(TRUE);
}
BOOL CMineInfo::OnInitDialog()
{
CDialog::OnInitDialog();
m_myButtonSubmit.AutoLoad(IDC_BTN_TIJIAO,this);
m_myButtonEdit.AutoLoad(IDC_BTN_AMEND,this);
m_myButtonExit.AutoLoad(IDC_BTN_OK,this);
m_myButtonClose.AutoLoad(IDC_BUT_CLOSE1,this);
m_myButtonMin.AutoLoad(IDC_BUT_MIN1,this);
///////////////////////////////////////////////////////////////////
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
/*************************1011修改个人信息提交**************/
void CMineInfo::OnBtnTijiao()
{
// TODO: Add your control notification handler code here
//////////////////////////////////////////////////////
//姓名
GetDlgItem(IDC_EDIT_USEN)->GetWindowText(m_Client.UserName);
if(m_Client.UserName == "")
{
GetDlgItem(IDC_EDIT_USEN)->SetFocus();
AfxMessageBox("您还没有填写姓名!");
return;
}
//////////////////////////////////////////////////////
//性别
GetDlgItem(IDC_COMBO_UserSex)->GetWindowText(m_Client.UserSex);
if(m_Client.UserSex == "")
{
GetDlgItem(IDC_COMBO_UserSex)->SetFocus();
AfxMessageBox("您还没有选择性别!");
return;
}
//////////////////////////////////////////////////////
//部门
GetDlgItem(IDC_COMBO_UserDptm)->GetWindowText(m_Client.UserDptm);
if(m_Client.UserDptm == "")
{
GetDlgItem(IDC_COMBO_UserDptm)->SetFocus();
AfxMessageBox("您还没有填写或选择部门!");
return;
}
//////////////////////////////////////////////////////
//职务
GetDlgItem(IDC_COMBO_UserDuty)->GetWindowText(m_Client.UserDuty);
if(m_Client.UserDuty == "")
{
GetDlgItem(IDC_COMBO_UserDuty)->SetFocus();
AfxMessageBox("您还没有输入或选择职务!");
return;
}
//////////////////////////////////////////////////////
//电话
GetDlgItem(IDC_EDIT_USET)->GetWindowText(m_Client.UserTel);
if(m_Client.UserTel == "")
{
GetDlgItem(IDC_EDIT_UserTel)->SetFocus();
AfxMessageBox("您还没有填写电话号码!");
return;
}
//////////////////////////////////////////////////////
//邮箱
GetDlgItem(IDC_EDIT_USEREMAL)->GetWindowText(m_Client.UserEmail);
if(m_Client.UserEmail == "")
{
GetDlgItem(IDC_EDIT_UserEmail)->SetFocus();
AfxMessageBox("您还没有填写邮箱!");
return;
}
////////////////////////////////////////
//打包数据
UpdateData(true);
CString strBuff;
CMsgBag m_bagTool;
m_Client.order = "1011";
m_Client.paramNum = 8;
m_bagTool.DataPackage(strBuff, &m_Client);
Sleep(50);
int mesgres = MessageBox("是否要提交数据?","提交数据",MB_OKCANCEL|MB_ICONQUESTION);
if(mesgres == IDOK)
{
((m_pMainDlg->m_pLoadDlg)->GetCClntSock()).OnSend(strBuff);
}
}
/***********************9011,9012信息处理*********************/
void CMineInfo::OnMeInfo(WPARAM wParam, LPARAM lParam)
{
CMsgBag mg;
CString strBuf = (char*)wParam;
long ret = mg.GetRetStatus(strBuf);
if(lParam == 9012)
{
if(ret == 1)
{
CString strRegParam[8];
mg.SplitDate(strBuf,strRegParam);
m_Client.UserId = strRegParam[0];
m_Client.UserPsw = strRegParam[1];
SetDlgItemText(IDC_EDIT_UserID, strRegParam[0]);
SetDlgItemText(IDC_EDIT_USEN, strRegParam[2]);
if(CString("男") == strRegParam[3])
{
((CComboBox*)GetDlgItem(IDC_COMBO_UserSex))->SetCurSel(0);
}
else
{
((CComboBox*)GetDlgItem(IDC_COMBO_UserSex))->SetCurSel(1);
}
//SetDlgItemText(IDC_COMBO_UserSex, strRegParam[3]);
SetDlgItemText(IDC_COMBO_UserDptm, strRegParam[4]);
SetDlgItemText(IDC_COMBO_UserDuty, strRegParam[5]);
SetDlgItemText(IDC_EDIT_USET, strRegParam[6]);
SetDlgItemText(IDC_EDIT_USEREMAL, strRegParam[7]);
}
else
{
AfxMessageBox("数据库正在维护,请稍后再试!");
m_pMainDlg->m_hModifyIfWnd = NULL;
::EndDialog(m_hWnd,0);
}
}
else if(lParam == 9011)
{
if(ret == 1)
{
AfxMessageBox("服务器已接收了你的资料。返回");
::EndDialog(m_hWnd,0);
}
else
{
AfxMessageBox("数据库正在维护,请稍后再试!");
::EndDialog(m_hWnd,0);
}
m_pMainDlg->m_hModifyIfWnd = NULL;
}
}
/**************关闭窗口*********************/
void CMineInfo::OnClose()
{
// TODO: Add your message handler code here and/or call default
m_pMainDlg->m_hModifyIfWnd = NULL;
OnDestroy();
}
void CMineInfo::OnOK()
{
// TODO: Add extra validation here
//CDialog::OnOK();
}
void CMineInfo::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
delete this;
}
void CMineInfo::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x,point.y));
CDialog::OnLButtonDown(nFlags, point);
}
void CMineInfo::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRgn m_rgn;
CRect rcWnd;
GetWindowRect(rcWnd);
m_rgn.m_hObject = CreateRoundRectRgn(0,0,rcWnd.Width()+1, rcWnd.Height()+1,20, 20 );
this->SetWindowRgn(m_rgn,true);
// Do not call CDialog::OnPaint() for painting messages
}
void CMineInfo::OnButMin()
{
// TODO: Add your control notification handler code here
PostMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0);
}
void CMineInfo::OnCloseWin()
{
// TODO: Add your control notification handler code here
OnClose();
}
void CMineInfo::OnBtnV()
{
CWnd* pWnd = GetFocus();
if(pWnd == GetDlgItem(IDC_BTN_AMEND))
{
OnBtnAmend();
}
else if(pWnd == GetDlgItem(IDC_BTN_TIJIAO))
{
OnBtnTijiao();
}
else
{
OnClose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -