Click here to Skip to main content
15,891,136 members
Articles / Desktop Programming / MFC

An MFC extension library to enable DLL plug-in technology for your application using MESSAGE_MAPs

Rate me:
Please Sign up or sign in to vote.
4.85/5 (47 votes)
8 Jun 2004CPOL17 min read 578.2K   8.6K   238  
A plug-in architecture which allows you to write plug-in DLLs for your application and extend/modify its functionality.
// AppPlugInCoreView.cpp : implementation of the CAppPlugInCoreView class
//

#include "stdafx.h"
#include "AppPlugInCore.h"

#include "AppPlugInCoreDoc.h"
#include "AppPlugInCoreView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CAppPlugInCoreView

IMPLEMENT_DYNCREATE(CAppPlugInCoreView, CPIView)

BEGIN_MESSAGE_MAP(CAppPlugInCoreView, CPIView)
	//{{AFX_MSG_MAP(CAppPlugInCoreView)
	ON_WM_LBUTTONDOWN()
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CPIView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CPIView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CPIView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAppPlugInCoreView construction/destruction

CAppPlugInCoreView::CAppPlugInCoreView()
{
	// TODO: add construction code here
	InitialisePlugIns() ;
}

CAppPlugInCoreView::~CAppPlugInCoreView()
{
}

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

	return CPIView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CAppPlugInCoreView drawing

void CAppPlugInCoreView::OnDraw(CDC* pDC)
{
	CAppPlugInCoreDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CAppPlugInCoreView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CAppPlugInCoreView diagnostics

#ifdef _DEBUG
void CAppPlugInCoreView::AssertValid() const
{
	CPIView::AssertValid();
}

void CAppPlugInCoreView::Dump(CDumpContext& dc) const
{
	CPIView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CAppPlugInCoreView message handlers

void CAppPlugInCoreView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	MessageBeep(MB_OK) ;	
	CPIView::OnLButtonDown(nFlags, point);
}

void CAppPlugInCoreView::OnSize(UINT nType, int cx, int cy) 
{
	CPIView::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	
}

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Sirius Analytical Instruments
United Kingdom United Kingdom
A research and development programmer working for a pharmaceutical instrument company for the past 17 years.

I am one of those lucky people who enjoys his work and spends more time than he should either doing work or reseaching new stuff. I can also be found on playing DDO on the Cannith server (Send a tell to "Maetrim" who is my current main)

I am also a keep fit fanatic, doing cross country running and am seriously into [url]http://www.ryushinkan.co.uk/[/url] Karate at this time of my life, training from 4-6 times a week and recently achieved my 1st Dan after 6 years.

Comments and Discussions