dialoga.cpp

来自「MFC DLL的编写和调用示例」· C++ 代码 · 共 88 行

CPP
88
字号
// DialogA.cpp : implementation file
//

#include "stdafx.h"
#include "DialogA.h"
#include "../DllB/Export.h"
#include "../DllB/DialogB.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDialogA dialog


CDialogA::CDialogA(CWnd* pParent /*=NULL*/)
	: CDialog(CDialogA::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDialogA)
	m_sEdit = _T("");
	//}}AFX_DATA_INIT
}


void CDialogA::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDialogA)
	DDX_Text(pDX, IDC_EDIT1, m_sEdit);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDialogA, CDialog)
	//{{AFX_MSG_MAP(CDialogA)
	ON_BN_CLICKED(IDC_BUTTONB, OnButtonb)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDialogA message handlers

void CDialogA::OnOK() 
{
	// TODO: Add extra validation here
	
	CDialog::OnOK();
}

BOOL CDialogA::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

int CDialogA::DoModal() 
{
	// TODO: Add your specialized code here and/or call the base class
	
	return CDialog::DoModal();
}

void CDialogA::OnButtonb() 
{
	// use this block for the Extension DLL
	{
	UpdateData();
	if ( ShowDialogB( m_sEdit ) == IDOK )
		UpdateData(FALSE);
	}
	// Use this block of code for a regular DLL
	{
/*	CDialogB	dlg;
	dlg.m_sText = m_sEdit;
	if ( dlg.DoModal() == IDOK ) {
		m_sEdit = dlg.m_sText;
		UpdateData(FALSE);
	}
*/	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?