【VC开源代码栏目提醒】:网学会员鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“DLLDlg2.cpp”一文,供大家参考学习
// DLLDlg2.cpp : implementation file
//
#include "stdafx.h"
#include "TestDLL.h"
#include "DLLDlg2.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDLLDlg2 dialog
CDLLDlg2::CDLLDlg2(CWnd* pParent /*=NULL*/)
: CDialog(CDLLDlg2::IDD, pParent)
{
//{{AFX_DATA_INIT(CDLLDlg2)
m_Str1 = _T("");
m_Str2 = _T("");
m_Str3 = _T("");
//}}AFX_DATA_INIT
pUI = NULL; //初始化指针
}
void CDLLDlg2::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDLLDlg2)
DDX_Text(pDX, IDC_EDIT1, m_Str1);
DDX_Text(pDX, IDC_EDIT2, m_Str2);
DDX_Text(pDX, IDC_EDIT3, m_Str3);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDLLDlg2, CDialog)
//{{AFX_MSG_MAP(CDLLDlg2)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDLLDlg2 message handlers
BOOL CDLLDlg2::OnInitDialog()
{
CDialog::OnInitDialog();
pUI = new CMyInterface; //申请内存空间
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
//--------------通过接口类导出CMyClass类中的FunctionA函数------------------
void CDLLDlg2::OnButton1()
{
m_Str1 = pUI->FunctionA();
UpdateData(false);
}
//---------------通过接口类导出CMyClass类中的FunctionB函数------------------
void CDLLDlg2::OnButton2()
{
//CMyInterface* pUI = new CMyInterface;
m_Str2 = pUI->FunctionB();
UpdateData(false);
}
//---------------通过接口类导出CMyClass类中的FunctionB函数------------------
void CDLLDlg2::OnButton3()
{
//CMyInterface* pUI = new CMyInterface;
m_Str3 = pUI->GetString();
UpdateData(false);
}
//-----------------------------释放动态内存空间---------------------------
void CDLLDlg2::OnDestroy()
{
CDialog::OnDestroy();
if(pUI != NULL)
{
delete pUI;
pUI = NULL;
}
}
//------------------------The End------------------------------------------
上一篇:
FrmClassMan.frm
下一篇:
如何在现代企业发展和推行绿色供应链