C++源码阅读Part 4.docx
- 文档编号:4360836
- 上传时间:2022-11-30
- 格式:DOCX
- 页数:14
- 大小:17.29KB
C++源码阅读Part 4.docx
《C++源码阅读Part 4.docx》由会员分享,可在线阅读,更多相关《C++源码阅读Part 4.docx(14页珍藏版)》请在冰豆网上搜索。
C++源码阅读Part4
C++SourceReadingComprehensionPart4
YHgldlg.cpp:
implementationfile
#include"stdafx.h"
#include"WordGLXT.h"
#include"YHgldlg.h"
#ifdef_WvSpDEBUG
#definenewDEBUG_WvSpNEW
#undefTHIS_WvSpFILE
staticcharTHIS_WvSpFILE()=_WvSp_WvSpFILE_WvSp_WvSp;
#endif
CYHgldlgdialog
CYHgldlg:
:
CYHgldlg(CWndpParent=NULL)
:
CDialog(CYHgldlg:
:
IDD,pParent)
{
{{AFX_WvSpDATA_WvSpINIT(CYHgldlg)
m_WvSpname=_WvSpT("");
m_WvSppwd=_WvSpT("");
m_WvSppwd1=_WvSpT("");
}}AFX_WvSpDATA_WvSpINIT
m_WvSphIcon=AfxGetApp()->LoadIcon(IDI_WvSpICONYHGL);
}
voidCYHgldlg:
:
DoDataExchange(CDataExchangepDX)
{
CDialog:
:
DoDataExchange(pDX);
{{AFX_WvSpDATA_WvSpMAP(CYHgldlg)
DDX_WvSpControl(pDX,IDC_WvSpCOMBO1,m_WvSpjb);
DDX_WvSpText(pDX,IDC_WvSpEDIT1,m_WvSpname);
DDX_WvSpText(pDX,IDC_WvSpEDIT2,m_WvSppwd);
DDX_WvSpText(pDX,IDC_WvSpEDIT3,m_WvSppwd1);
}}AFX_WvSpDATA_WvSpMAP
}
BEGIN_WvSpMESSAGE_WvSpMAP(CYHgldlg,CDialog)
{{AFX_WvSpMSG_WvSpMAP(CYHgldlg)
ON_WvSpBN_WvSpCLICKED(IDC_WvSpBUTTON1,OnButton1)
}}AFX_WvSpMSG_WvSpMAP
END_WvSpMESSAGE_WvSpMAP()
CYHgldlgmessagehandlers
BOOLCYHgldlg:
:
OnInitDialog()
{
CDialog:
:
OnInitDialog();
TODO:
Addextrainitializationhere
SetIcon(m_WvSphIcon,TRUE);
m_WvSpjb.AddString("系统管理员");
m_WvSpjb.AddString("普通管理员");
t=CTime:
:
GetCurrentTime();
returnTRUE;returnTRUEunlessyousetthefocustoacontrol
EXCEPTION:
OCXPropertyPagesshouldreturnFALSE
}
voidCYHgldlg:
:
OnOK()
{
TODO:
Addextravalidationhere
UpdateData(true);
if(m_WvSpname=="")
{
MessageBox("请输入用户名","文档管理系统");
return;
}
CStringjb;
m_WvSpjb.GetWindowText(jb);
if(jb=="")
{
MessageBox("级别不能为空","文档管理系统");
return;
}
if(m_WvSppwd=="")
{
MessageBox("请输入密码","文档管理系统");
return;
}
if(m_WvSppwd1=="")
{
MessageBox("请确认密码","文档管理系统");
return;
}
if(m_WvSppwd!
=m_WvSppwd1)
{
MessageBox("两次密码不同","文档管理系统");
return;
}
CUsersser;
if(ser.Havename(m_WvSpname)==1)
{
MessageBox("用户以存在,请重新输入","文档管理系统");
return;
}
ser.SetUsername(m_WvSpname);
ser.SetPwd(m_WvSppwd);
m_WvSpjb.GetLBText(m_WvSpjb.GetCurSel(),strjb);
if(strjb=="系统管理员")
strjb="1";
else
strjb="0";
ser.SetJB(strjb);
ser.sql_WvSpinsert();
zhi.SetDLsj(t.Format("%y-%m-%d"));
zhi.SetName(user.GetUsername());
zhi.SetDZ("添加用户");
zhi.sql_WvSpinsert();
CDialog:
:
OnOK();
}
voidCYHgldlg:
:
OnButton1()
{
TODO:
Addyourcontrolnotificationhandlercodehere
UpdateData(true);
if(MessageBox("是否删除当前记录","请确认",MB_WvSpYESNO)==IDYES)
{
CUsersser;
ser.sql_WvSpdelete(m_WvSpname);
zhi.SetDLsj(t.Format("%y-%m-%d"));
zhi.SetName(user.GetUsername());
zhi.SetDZ("用户删除");
zhi.sql_WvSpinsert();
}
CDialog:
:
OnOK();
}
BOOLCYHgldlg:
:
PreTranslateMessage(MSGpMsg)
{
TODO:
Addyourspecializedcodehereandorcallthebaseclass
if(pMsg->message==WM_WvSpKEYDOWN&&pMsg->wParam==13)
pMsg->wParam=9;
returnCDialog:
:
PreTranslateMessage(pMsg);
}
C++SourceReadingComprehensionPart5
qyzx.cpp:
implementationfile
#include"stdafx.h"
#include"khmanager.h"
#include"qyzx.h"
#include"ado.h"
#ifdef_WvSpDEBUG
#definenewDEBUG_WvSpNEW
#undefTHIS_WvSpFILE
staticcharTHIS_WvSpFILE()=_WvSp_WvSpFILE_WvSp_WvSp;
#endif
intqyzxclnum=0;
intqyzxxiugai=0;
qyzxdialog
qyzx:
:
qyzx(CWndpParent=NULL)
:
CDialog(qyzx:
:
IDD,pParent)
{
{{AFX_WvSpDATA_WvSpINIT(qyzx)
NOTE:
theClassWizardwilladdmemberinitializationhere
}}AFX_WvSpDATA_WvSpINIT
}
voidqyzx:
:
DoDataExchange(CDataExchangepDX)
{
CDialog:
:
DoDataExchange(pDX);
{{AFX_WvSpDATA_WvSpMAP(qyzx)
DDX_WvSpControl(pDX,IDC_WvSpLIST1,m_WvSplist);
DDX_WvSpControl(pDX,IDC_WvSpEDIT3,m_WvSpedit3);
DDX_WvSpControl(pDX,IDC_WvSpEDIT2,m_WvSpedit2);
DDX_WvSpControl(pDX,IDC_WvSpEDIT1,m_WvSpedit1);
}}AFX_WvSpDATA_WvSpMAP
}
BEGIN_WvSpMESSAGE_WvSpMAP(qyzx,CDialog)
{{AFX_WvSpMSG_WvSpMAP(qyzx)
ON_WvSpCOMMAND(ID_WvSpADD,OnAdd)
ON_WvSpCOMMAND(ID_WvSpDELETE,OnDelete)
ON_WvSpCOMMAND(ID_WvSpEXIT,OnExit)
ON_WvSpCOMMAND(ID_WvSpUPDATE,OnUpdate)
ON_WvSpCOMMAND(ID_WvSpSAVE,OnSave)
ON_WvSpCOMMAND(ID_WvSpCANCEL,OnCancel)
ON_WvSpNOTIFY(NM_WvSpDBLCLK,IDC_WvSpLIST1,OnDblclkList1)
}}AFX_WvSpMSG_WvSpMAP
END_WvSpMESSAGE_WvSpMAP()
qyzxmessagehandlers
BOOLqyzx:
:
OnInitDialog()
{
CDialog:
:
OnInitDialog();
imagelist.Create(32,32,ILC_WvSpCOLOR32|ILC_WvSpMASK,0,0);
imagelist.Add(:
:
LoadIcon(:
:
AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_WvSpICON1)));
imagelist.Add(:
:
LoadIcon(:
:
AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_WvSpICON2)));
imagelist.Add(:
:
LoadIcon(:
:
AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_WvSpICON3)));
imagelist.Add(:
:
LoadIcon(:
:
AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_WvSpICON4)));
imagelist.Add(:
:
LoadIcon(:
:
AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_WvSpICON5)));
imagelist.Add(:
:
LoadIcon(:
:
AfxGetResourceHandle(),MAKEINTRESOURCE(IDI_WvSpICON10)));
CStrings;
TCHARpString;
menu.LoadMenu(IDR_WvSplxrxx);
toolbar.EnableAutomation();
toolbar.Create(WS_WvSpCHILD|WS_WvSpVISIBLE,CRect(0,0,0,0),this,ID_WvSpTOOLBAR);
toolbar.SetImageList(&imagelist);
inti;
for(i=0;i<8;i++)
{
button(i).dwData=0;
button(i).fsState=TBSTATE_WvSpENABLED;
button(i).fsStyle=TBSTYLE_WvSpBUTTON;
}
button(5).fsStyle=TBSTYLE_WvSpSEP;
button(0).idCommand=ID_WvSpADD;
button(0).iBitmap=0;
button
(1).idCommand=ID_WvSpUPDATE;
button
(1).iBitmap=1;
button
(2).idCommand=ID_WvSpDELETE;
button
(2).iBitmap=2;
button(3).idCommand=ID_WvSpSAVE;
button(3).iBitmap=3;
button(4).idCommand=ID_WvSpCANCEL;
button(4).iBitmap=4;
button(6).idCommand=ID_WvSpEXIT;
button(6).iBitmap=5;
for(i=0;i<8;i++)
{
s.LoadString(i+IDS_WvSp21);
intnStringLength=s.GetLength()+1;
pString=s.GetBufferSetLength(nStringLength);
button(i).iString=toolbar.AddStrings(pString);
s.ReleaseBuffer();
}
toolbar.AddButtons(7,button);
toolbar.AutoSize();
toolbar.SetStyle(TBSTYLE_WvSpFLAT|CCS_WvSpTOP);
toolbar.EnableButton(ID_WvSpSAVE,false);
toolbar.EnableButton(ID_WvSpCANCEL,false);
m_WvSplist.ModifyStyle(0L,LVS_WvSpREPORT);
m_WvSplist.ModifyStyle(0L,LVS_WvSpSINGLESEL);
m_WvSplist.ModifyStyle(0L,LVS_WvSpSHOWSELALWAYS);
m_WvSplist.ModifyStyle(0L,LVS_WvSpNOSORTHEADER);
m_WvSplist.SetExtendedStyle(LVS_WvSpEX_WvSpGRIDLINES|
LVS_WvSpEX_WvSpFULLROWSELECT|
LVS_WvSpEX_WvSpHEADERDRAGDROP|
LVS_WvSpEX_WvSpONECLICKACTIVATE);
m_WvSplist.InsertColumn(0,"企业资信编号");
m_WvSplist.InsertColumn(1,"资信级别");
m_WvSplist.InsertColumn(2,"备注信息");
m_WvSplist.SetColumnWidth(0,100);
m_WvSplist.SetColumnWidth(1,100);
m_WvSplist.SetColumnWidth(2,100);
this->loadlist();
this->enbalewin(false);
this->datatotext();
this->texttowin();
returnTRUE;returnTRUEunlessyousetthefocustoacontrol
EXCEPTION:
OCXPropertyPagesshouldreturnFALSE
}
voidqyzx:
:
OnAdd()
{
this->enbalewin(true);
this->enablebutton(false);
this->clearall();
this->autonum();
}
voidqyzx:
:
OnCancel()
{
this->enbalewin(false);
this->enablebutton(true);
qyzxxiugai=0;
this->datatotext();
this->texttowin();
}
voidqyzx:
:
OnDelete()
{
adorst;
CStringss,aa;
this->m_WvSpedit1.GetWindowText(aa);
if(aa.IsEmpty())
{MessageBox("不能为空","提示");
return;}
if(MessageBox("删除后数据将丢失","提示",MB_WvSpYESNO)==IDYES)
{
ss.Format("deletefromtb_WvSpClient_WvSpqyzxwhereqyzx_WvSpid='%s'",aa);
rst.ExecuteSQL(ss);
m_WvSplist.DeleteAllItems();
this->loadlist();
this->datatotext();
this->texttowin();
}
}
voidqyzx:
:
OnExit()
{
this->EndDialog(true);
}
voidqyzx:
:
OnUpdate()
{
CStringss,aa;
this->m_WvSpedit1.GetWindowText(aa);
if(aa.IsEmpty())
{MessageBox("不能为空","提示");
return;}
this->enbalewin(true);
this->enablebutton(false);
qyzxxiugai=1;
}
voidqyzx:
:
OnSave()
{
adorst;
this->wintotext();
CStringss,srept;
srept.Format("selectfromtb_WvSpClient_WvSpqyzxwhereqyzx_WvSpzxjb='%s'",edit2);
rst.rstOpen(srept);
if(rst.GetRecordCount()>0)
{
MessageBox("这个资信级别已经存在了","提示");
return;
}
if(qyzxxiugai==1)
{ss.Format("UPDATEtb_WvSpClient_WvSpqyzxsetqyzx_WvSpzxjb='%s',qyzx_WvSpbz='%s'whereqyzx_WvSpid='%s'",edit2,edit3,edit1);}
else
{ss.Format("INSERTINTOtb_WvSpClient_WvSpqyzxvalues('%s','%s','%s')",edit1,edit2,edit3);}
rst.ExecuteSQL(ss);
m_WvSplist.DeleteAllItems();
this->loadlist();
this->datatotext();
this->texttowin();
this->enbalewin(false);
this->enablebutton(true);
qyzxxiugai=0;
}
voidqyzx:
:
clearall()
{
this->m_WvSpedit1.SetWindowText("");
this->m_WvSpedit2.SetWindowText("");
this->m_WvSpedit3.SetWindowText("");
}
voidqyzx:
:
enablebutton(boolbutn)
{
toolbar.EnableButton(ID_WvSpADD,butn);
toolbar.EnableButton(ID_WvSpUPDATE,butn);
toolbar.EnableButton(ID_WvSpDELETE,butn);
toolbar.EnableButton(ID_WvSpSAVE,!
butn);
toolbar.EnableButton(ID_WvSpCANCEL,!
butn);
}
voidqyzx:
:
enbalewin(boolwi)
{
this->m_WvSpedit1.EnableWindow(wi);
this->m_WvSpedit2.EnableWindow(wi);
this->m_WvSpedit3.EnableWindow(wi);
}
voidqyzx:
:
texttowin()
{
this->m_WvSpedit1.SetWindowText(edit1);
this->m_WvSpedit2.SetWindowText(edit2);
this->m_WvSpedit3.SetWindowText(edit3);
}
voidqyzx:
:
wintotext()
{
this->m_WvSpedit1.GetWindowText(edit1);
this->m_WvSpedit2.GetWindowText(edit2);
this->m_WvSpedit3.GetWindowText(edit3);
}
voidqyzx:
:
datatotext()
{
edit1=m_WvSplist.GetItemText(qyzxclnum,0);
edit2=m_WvSplist.GetItemText(qyzxclnum,1);
edit3=m_WvSplist.GetItemText(qyzxclnum,2);
}
voidqyzx:
:
loadlist()
{
adorst;
rst.rstOpen("selectfromtb_WvSpClient_WvSpqyzx");
intrecordcount=rst.GetRecordCount();
intii;
for(ii=1;ii<=recordcount;ii++)
{
m_WvSplist.InsertItem(ii-1,"");
m_WvSplist.SetItemText(ii-1,0,rst.GetFieldValue("qyzx_WvSpid"));
m_WvSplist.SetItemText(ii-1,1,rst.GetFieldValue("qyzx_WvSpzxjb"));
m_WvSplist.SetItemText(ii-1,2,rst.GetFieldValue("qyzx_WvSpbz"));
rst.Move(ii);
}
rst.close();
}
voidqyzx:
:
autonum()
{
adorst3;
rst3.rstOpen("selectfromtb_WvSpClient_WvSpqyzx");
if(rst3.GetRecordCount()==0)
{
this->m_WvSpedit1.SetWindowText("ZX001");
this->m_WvSpedit1.EnableWindow(false);
return;
}
rst3.MoveLast
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C+源码阅读Part C+ 源码 阅读 Part