Click here to Skip to main content
15,896,153 members
Articles / Desktop Programming / MFC

How to use Dynamic External MFC CView Class Objects (which exists in a DLL library) in a VBA Host MFC Application

Rate me:
Please Sign up or sign in to vote.
1.00/5 (10 votes)
8 Dec 20023 min read 57.3K   389   11  
Implement interface between two existing DLL Library in a VBA Host MFC application.
// TangramMFCView.cpp : implementation of the CTangramMFCView class
//

#include "stdafx.h"
#include "TangramMFC.h"

#include "TangramMFCDoc.h"
#include "TangramMFCView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CTangramMFCView

IMPLEMENT_DYNCREATE(CTangramMFCView, CTangramDesignView)

BEGIN_MESSAGE_MAP(CTangramMFCView, CTangramDesignView)
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CTangramDesignView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CTangramDesignView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CTangramDesignView::OnFilePrintPreview)
END_MESSAGE_MAP()

// CTangramMFCView construction/destruction

CTangramMFCView::CTangramMFCView()
{
	// TODO: add construction code here

}

CTangramMFCView::~CTangramMFCView()
{
}

BOOL CTangramMFCView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CTangramDesignView::PreCreateWindow(cs);
}

// CTangramMFCView drawing

void CTangramMFCView::OnDraw(CDC* /*pDC*/)
{
	CTangramMFCDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	// TODO: add draw code for native data here
}
///////////////$tangramapp$/////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// CTestVbaView Vba Design Support:
void CTangramMFCView::SetDesignerPage()
{
	LoadFromResource(IDR_DesignHTML);
}
///////////////$tangramapp end$/////////////////////////////////////////////////

// CTangramMFCView printing

BOOL CTangramMFCView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CTangramMFCView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CTangramMFCView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}


// CTangramMFCView diagnostics

#ifdef _DEBUG
void CTangramMFCView::AssertValid() const
{
	CTangramDesignView::AssertValid();
}

void CTangramMFCView::Dump(CDumpContext& dc) const
{
	CTangramDesignView::Dump(dc);
}

CTangramMFCDoc* CTangramMFCView::GetDocument() const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTangramMFCDoc)));
	return (CTangramMFCDoc*)m_pDocument;
}
#endif //_DEBUG


// CTangramMFCView message handlers

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions