帮我把这段代码注释一下,我需要讲个老师听,就是每个步骤的用处 40
//AddDialog.cpp:实现文件//#include"stdafx.h"#include"MFCSecond.h"#include"AddDialog.h"#in...
// AddDialog.cpp : 实现文件
//
#include "stdafx.h"
#include "MFCSecond.h"
#include "AddDialog.h"
#include "afxdialogex.h"
#include "ADOUtil.h"
// CAddDialog 对话框
IMPLEMENT_DYNAMIC(CAddDialog, CBookDialog)
CAddDialog::CAddDialog(CDBUtils * pDBUtil,CWnd* pParent /*=NULL*/)
: CBookDialog(pDBUtil, pParent)
{
}
CAddDialog::~CAddDialog()
{
}
void CAddDialog::DoDataExchange(CDataExchange* pDX)
{
CBookDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAddDialog, CBookDialog)
//ON_BN_CLICKED(IDC_BUTTON_CANLENDAR, &CBookDialog::OnBnClickedButtonCanlendar)
END_MESSAGE_MAP()
// CAddDialog 消息处理程序
void CAddDialog::ButtonOK()
{
UpdateData();
if(m_strName != "" &&
m_strWriter != "" &&
m_strISBN != "" &&
m_strPubDate != "" &&
m_strPrice != "" ){
if(m_pDBUtil != NULL){
//(1)ODBC
//m_pDBUtil->AddBook(m_strName,m_strWriter,m_strISBN,m_strPubDate,m_strPrice);
//EndDialog(IDOK);
//(2)ADO -- _CommandPtr
CADOUtil util;
if(util.InitADO() && util.OpenADO()){
Book book;
book.m_strName = m_strName;
book.m_strWriter = m_strWriter;
book.m_strISBN = m_strISBN;
book.m_strPubDate = m_strPubDate;
book.m_strPrice = m_strPrice;
util.AddBook(book);
EndDialog(IDOK);
}
}else {
MessageBox(L"数据库错误",L"提示");
EndDialog(IDCANCEL);
}
}else{
MessageBox(L"请输入完整信息",L"提示");
}
}
void CAddDialog::ButtonCancel()
{
CBookDialog::ButtonCancel();
} 展开
//
#include "stdafx.h"
#include "MFCSecond.h"
#include "AddDialog.h"
#include "afxdialogex.h"
#include "ADOUtil.h"
// CAddDialog 对话框
IMPLEMENT_DYNAMIC(CAddDialog, CBookDialog)
CAddDialog::CAddDialog(CDBUtils * pDBUtil,CWnd* pParent /*=NULL*/)
: CBookDialog(pDBUtil, pParent)
{
}
CAddDialog::~CAddDialog()
{
}
void CAddDialog::DoDataExchange(CDataExchange* pDX)
{
CBookDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAddDialog, CBookDialog)
//ON_BN_CLICKED(IDC_BUTTON_CANLENDAR, &CBookDialog::OnBnClickedButtonCanlendar)
END_MESSAGE_MAP()
// CAddDialog 消息处理程序
void CAddDialog::ButtonOK()
{
UpdateData();
if(m_strName != "" &&
m_strWriter != "" &&
m_strISBN != "" &&
m_strPubDate != "" &&
m_strPrice != "" ){
if(m_pDBUtil != NULL){
//(1)ODBC
//m_pDBUtil->AddBook(m_strName,m_strWriter,m_strISBN,m_strPubDate,m_strPrice);
//EndDialog(IDOK);
//(2)ADO -- _CommandPtr
CADOUtil util;
if(util.InitADO() && util.OpenADO()){
Book book;
book.m_strName = m_strName;
book.m_strWriter = m_strWriter;
book.m_strISBN = m_strISBN;
book.m_strPubDate = m_strPubDate;
book.m_strPrice = m_strPrice;
util.AddBook(book);
EndDialog(IDOK);
}
}else {
MessageBox(L"数据库错误",L"提示");
EndDialog(IDCANCEL);
}
}else{
MessageBox(L"请输入完整信息",L"提示");
}
}
void CAddDialog::ButtonCancel()
{
CBookDialog::ButtonCancel();
} 展开
1个回答
展开全部
Main.tab_panel.setActiveTab(Main.welcome_tab); //将welcome_tab这个面板切换为活动面板(当前显示面板)
Main.ClearTab=function(){ //定义一个函数ClearTab
Main.tab_panel.items.each(function(item){//遍历tab_panel下的所有面板
if(item.closable){ //如果当前遍历的面板可关闭
Main.tab_panel.remove(item.id); //根据该面板的id关闭面板
}
});
};
Main.CurrentGrid=function(){ //定义一个函数CurrentGrid
return Main.tab_panel.getActiveTab().items.items[0]; //返回当前活动面板的第一个控件(grid)
};
Main.ClearTab=function(){ //定义一个函数ClearTab
Main.tab_panel.items.each(function(item){//遍历tab_panel下的所有面板
if(item.closable){ //如果当前遍历的面板可关闭
Main.tab_panel.remove(item.id); //根据该面板的id关闭面板
}
});
};
Main.CurrentGrid=function(){ //定义一个函数CurrentGrid
return Main.tab_panel.getActiveTab().items.items[0]; //返回当前活动面板的第一个控件(grid)
};
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询