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

Plug-In framework using DLLs

Rate me:
Please Sign up or sign in to vote.
4.84/5 (39 votes)
25 Jun 200211 min read 311.4K   8.7K   226  
Explains how to develop applications that support plug-ins
// PlugSDIView.cpp : implementation of the CPlugSDIView class
//

#include "stdafx.h"
#include "PlugSDI.h"

#include "PlugSDIDoc.h"
#include "PlugSDIView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CPlugSDIView

IMPLEMENT_DYNCREATE(CPlugSDIView, CScrollView)

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

// CPlugSDIView construction/destruction

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

}

CPlugSDIView::~CPlugSDIView()
{
}

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

	return CScrollView::PreCreateWindow(cs);
}

// CPlugSDIView drawing

void CPlugSDIView::OnDraw(CDC* /*pDC*/)
{
	CPlugSDIDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	// TODO: add draw code for native data here
}

void CPlugSDIView::OnInitialUpdate()
{
	CScrollView::OnInitialUpdate();
	CSize sizeTotal;
	// TODO: calculate the total size of this view
	sizeTotal.cx = sizeTotal.cy = 100;
	SetScrollSizes(MM_TEXT, sizeTotal);
}


// CPlugSDIView printing

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

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

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


// CPlugSDIView diagnostics

#ifdef _DEBUG
void CPlugSDIView::AssertValid() const
{
	CScrollView::AssertValid();
}

void CPlugSDIView::Dump(CDumpContext& dc) const
{
	CScrollView::Dump(dc);
}

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


// CPlugSDIView 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
India India
Living in New Delhi (India). Did my Engg (Comp. Science) in 2000, and since then working on and off with VC++. It's my passion, and would really love to learn it to the very detail. Presently working as a software engg in a Telecom based firm. I've got around 3yrs experience in NMS (network management systems). Well thats all about me for now. Feel free to contact me...

Comments and Discussions