📄 myadddel.cpp
字号:
// MyAddDel.cpp : implementation file
//
#include "stdafx.h"
#include "myprinter.h"
#include "MyAddDel.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyAddDel dialog
CMyAddDel::CMyAddDel(CWnd* pParent /*=NULL*/)
: CDialog(CMyAddDel::IDD, pParent)
{
EnableAutomation();
//{{AFX_DATA_INIT(CMyAddDel)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
HRESULT hr;
//初始化连接指针
CoInitialize(NULL);
hr=p_connection.CreateInstance(_uuidof(Connection));
if(FAILED(hr))
{
CWnd::MessageBox ("_ConnectionPtr初始化错误!");
}
//初始化recordset指针
hr=p_recordset.CreateInstance(_uuidof(Recordset));
if(FAILED(hr))
{
CWnd::MessageBox ("_RecordsetPtr初始化错误!");
}
}
void CMyAddDel::OnFinalRelease()
{
// When the last reference for an automation object is released
// OnFinalRelease is called. The base class will automatically
// deletes the object. Add additional cleanup required for your
// object before calling the base class.
CDialog::OnFinalRelease();
}
void CMyAddDel::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyAddDel)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyAddDel, CDialog)
//{{AFX_MSG_MAP(CMyAddDel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BEGIN_DISPATCH_MAP(CMyAddDel, CDialog)
//{{AFX_DISPATCH_MAP(CMyAddDel)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()
// Note: we add support for IID_IMyAddDel to support typesafe binding
// from VBA. This IID must match the GUID that is attached to the
// dispinterface in the .ODL file.
// {2680B346-C2CD-4FFA-B473-F1297BFE99B3}
static const IID IID_IMyAddDel =
{ 0x2680b346, 0xc2cd, 0x4ffa, { 0xb4, 0x73, 0xf1, 0x29, 0x7b, 0xfe, 0x99, 0xb3 } };
BEGIN_INTERFACE_MAP(CMyAddDel, CDialog)
INTERFACE_PART(CMyAddDel, IID_IMyAddDel, Dispatch)
END_INTERFACE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyAddDel message handlers
BOOL CMyAddDel::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
p_AddName.p_connection =this->p_connection ;
//p_AddName.p_recordset =this->p_recordset ;
p_AddPlant.p_connection =p_connection;
//p_AddPlant.p_recordset =this->p_recordset ;
p_AddOther.p_connection =p_connection;
//_AddOther.p_recordset =p_recordset;
// p_DelName.p_connection=p_connection;
// p_DelName.p_recordset =p_recordset;
// p_DelPlant.p_connection =p_connection;
// p_DelPlant.p_connection =p_recordset;
// p_DelOther.p_connection =p_connection;
// p_DelOther.p_recordset =p_recordset;
CenterWindow();
m_Sheet.AddPage(&p_AddName);
m_Sheet.AddPage(&p_AddPlant);
m_Sheet.AddPage(&p_AddOther);
//m_Sheet.AddPage(&p_DelName);
//m_Sheet.AddPage(&p_DelPlant);
//m_Sheet.AddPage(&p_DelOther);
m_Sheet.Create (this,WS_CHILD|WS_VISIBLE,0);
m_Sheet.ModifyStyleEx (0,WS_EX_CONTROLPARENT);
m_Sheet.ModifyStyle (0,WS_TABSTOP);
m_Sheet.SetWindowPos (NULL,2,2,0,0,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);
if(i_Type==1) m_Sheet.SetActivePage (&p_AddName);
else if(i_Type==2) m_Sheet.SetActivePage (&p_AddPlant);
else if(i_Type==3) m_Sheet.SetActivePage (&p_AddOther);
//else if(i_Type==11) m_Sheet.SetActivePage (&p_DelName);
//else if(i_Type==12) m_Sheet.SetActivePage (&p_DelPlant);
//else if(i_Type==13) m_Sheet.SetActivePage (&p_DelOther);
else m_Sheet.SetActivePage (&p_AddName);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//DEL void CMyAddDel::OnMenuAdd()
//DEL {
//DEL // TODO: Add your command handler code here
//DEL
//DEL }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -