Click here to Skip to main content
15,885,906 members
Articles / Desktop Programming / MFC

Using a Doc/View exported from a dynamically loaded DLL (SDI)

Rate me:
Please Sign up or sign in to vote.
4.93/5 (13 votes)
6 May 20025 min read 200.7K   4.8K   75  
An article on on how to load DLLs which export views into a SDI Application
// SdiDllFramesView.cpp : implementation of the CSdiDllFramesView class
//

#include "stdafx.h"
#include "SdiDllFrames.h"

#include "SdiDllFramesDoc.h"
#include "SdiDllFramesView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSdiDllFramesView

IMPLEMENT_DYNCREATE(CSdiDllFramesView, CView)

BEGIN_MESSAGE_MAP(CSdiDllFramesView, CView)
	//{{AFX_MSG_MAP(CSdiDllFramesView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSdiDllFramesView construction/destruction

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

}

CSdiDllFramesView::~CSdiDllFramesView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CSdiDllFramesView drawing

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

/////////////////////////////////////////////////////////////////////////////
// CSdiDllFramesView diagnostics

#ifdef _DEBUG
void CSdiDllFramesView::AssertValid() const
{
	CView::AssertValid();
}

void CSdiDllFramesView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CSdiDllFramesView 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
United States United States
Dave has been programming for the past 20+ years first on a variety of platforms and operating systems using various languages. As a hobbyist Dave cut his teeth on the Commodore Pet and the 64 coding in basic and then moving to 6502 ASM. Dave moved to the Amiga using 68000 ASM and then C. His knowledge of the C language offered the stepping stone for him to make his hobby his profession taking a position coding C on an AIX Unix platform. Since then he has worked on many flavors of Unix, QNX, Windows (3.11 – present), and has been coding games for his Pocket PC in his spare time.

Dave lives in Indiana with his two teenage daughters and two cats.

Comments and Discussions